Calendar Validation
The Nitobi Calendar has a number of events you can subscribe to to implement full client-side validation.
Invalid Dates
The Nitobi Calendar distinguishes between three types of invalid dates:
- Out Of Range Date - If the selected date falls outside the range defined by the mindate and maxdate attributes.
- Invalid Format - If the date isn't a valid format (e.g. if the date entered into the DateInput field doesn't match the edit mask).
- Disabled Date - If the date to be selected is defined as disabled.
Each type of invalid date has a JavaScript event associated with it which you can subscribe to through the declaration using the following attributes (defined on the ntb:datepicker tag):
- onsetoutofrangedate
- onsetinvaliddate
- onsetdisableddate
Here is an example implementation:
<ntb:datepicker id="dp" theme="leopard" mindate="yesterday" ondateselected="resetError()" onsetinvaliddate="handleInvalid(eventArgs)" onsetoutofrangedate="handleOutOfRange(eventArgs)"> <ntb:dateinput displaymask="dd MMM yyyy" editmask="yyyy-MM-dd"></ntb:dateinput> <ntb:calendar></ntb:calendar> </ntb:datepicker>
page_revision: 3, last_edited: 1224629809|%e %b %Y, %H:%M %Z (%O ago)