By design, we do not prevent the user from momentarily selecting a date before start date, because doing so would impose annoying restrictions on the precise order in which the user picks month, day and year.
We're not clear on what your question is now. You've shown a validator and you've set validateOnChange, so validation will indeed be triggered when the user selects a date. But for some reason you are still asking how to do what you've already done? Could you rephrase your question perhaps?
I have the validator and an error message set on the DateItem, however, the erorr message is NOT displaying when the user selects a date that is not in the Range.
So, my question is that I want to show an error message when an invalid date is clicked on.
What I am seeing is that when an invalid date is selected the DateChooser of the DateItem closes.
I do not want to close, I want to show an error message.
The error should be showing up as soon as the invalid date is selected.
By default it'll show up as an error icon next to the form item, though there are various other validationError presentations supported (error message displayed inline next to, or above the item, all validation errors shown at the top of the form etc).
You can also override 'showErrors' on the DynamicForm for entirely custom error-handling.
- If this doesn't match what you are seeing there must be something else going on and we'd need to see a test case / have step by step instructions to reproduce exactly what you are seeing.
Note: There is no built-in mode which will keep the picker open if the user picks an invalid date, so if this is user experience is a hard requirement for your app you'd need to come up with a programmatic way to achieve this. A possiblity might be to add a custom dataChanged handler to the DateChooser (using 'setPickerProperties' on the DateItem) -- or even roll your own custom formItem with its own pickerItem and custom picker which shows an entirely custom DateChooser, etc.
Comment