-
-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Date field using dropdown display mode does not accept year input #2261
Comments
This is a bit of a limitation with the dropdown/input for a Date field, as it doesn't at the moment really handle partial dates. This is because under the hood, the value for the Date field is a PHP Fixing this will almost certainly require a breaking change where we are proposing a custom So the short of it is, there's not really a method to use year, year+month combinations, it has to be "full" date, "full" time, or date + time. |
Thanks for the info, probably worth highlighting this in the documentation at some point, that partial dates basically can't be supported under the dropdown mode currently. The year field in the date/time field is nice because of its dynamic nature of start/end values, relative to the current year. I'll look at implementing something similar in a dropdown to workaround it or perhaps a free text field but with number validation and a range between to implement the same. |
Yep, I've been messing around with options for the past few months, but nothing satisfying that doesn't break things. Of course, I'd rather fix this behaviour up now! We do also have plans to modify the preset behaviour for Dropdown fields. Currently they just act as ways to preload data, but once it's in, it's essentially set. In the future, we'll have proper preset, dynamic options for this sort of scenario. |
That's great to hear Josh, exciting developments ahead! For now I will implement a text field but with number/dynamic range validation to mimic the same offered by the date/field dropdown year field and use that for now. |
Describe the bug
When using a date field with the dropdown display mode, the input is not accepted on the front end.
In this example a date field with just the year field enabled is used. I selected 2011 from the select menu, when I submitted the form it was returned with the validation error of "Year cannot be blank"
Potentially the wrong handle/name value is being used where the data is not being sent properly?
Raised from #2244
Steps to reproduce
Form settings
Craft CMS version
5.6.1
Plugin version
3.0.19
Multi-site?
No
Additional context
No response
The text was updated successfully, but these errors were encountered: