Good afternoon!
Sounds simple but I've hit a roadblock. I'm looking for a simple rule for field definition that would hide the rest of a form if the a date field was manually entered incorrectly.
For example, I'm using the default formatting of (MMM dd, yyyy) so calendar picked dates should work without issue, however, if someone were to type in "01/01/2020" or "qwerty" I'd want the rule to kick in, hide the form and pop up an error info field. Is there a quick and easy way to do this?
You can validate your date, and it's timestamp property in particular
As the date that cannot be parsed usually is set to January 1st 1970 at midnight GMT (Greenwich Mean Time)
So, you can check if it is larger than that or not (which is 0 timestamp)
Something like this: http://recordit.co/YtTD6AG48G
Alex
This is great! Works well, but what if a user types in a number, like "1" or "123"? Since the date field is numeric, the timestamp logic doesn't appear to catch just a random number. Is there a workaround to prevent that?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can make it validate agains some other value than 0
For example, the date should be not before January 1 2021
Checking that it is larger than 1609459200000
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.