You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a field called start_at, and I'm using start_at_date in a form. If the user doesn't enter a valid date, it throws an exception "invalid date". Is it possible to use validation instead to prompt the user to enter a valid date?
The text was updated successfully, but these errors were encountered:
What are you currently using for validation? I use date_validator when validating dates. In any case, however you decide to validate your dates, you can validate the split fields in exactly the same way as the primary field.
However, if you're trying to just get the user to consistently input the correct format, I would recommend using some kind of datepicker interface. The jQueryUI datepicker will work pretty well in most cases for just a date.
If you're looking for a combined datetime picker, I've been looking at this one as one of the friendlier mixed pickers I've seen.
I ran into this issue as well. We're using a javascript plugin to let the users pick the date, but they can still edit the text field themselves, which I think is a must from a UX perspective.
So if the user enters something like "2014" for the date part, this code will do Date.parse("2014"), which will raise an exception. Maybe it is better to rescue the ArgumentError in this method?
I have a field called start_at, and I'm using start_at_date in a form. If the user doesn't enter a valid date, it throws an exception "invalid date". Is it possible to use validation instead to prompt the user to enter a valid date?
The text was updated successfully, but these errors were encountered: