Validation extensions to the
Datepick
plugin.- Source:
Members
(inner) regionalOptions
Localisations for the validation messages.
Entries are objects indexed by the language code ('' being the default US/English).
Properties:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
validateDate |
string |
<optional> |
'Please enter a valid date' | Basic validation error message. |
validateDateMin |
string |
<optional> |
'Please enter a date on or after {0}' | Minimum date validation message. |
validateDateMax |
string |
<optional> |
'Please enter a date on or before {0}' | Maximum date validation message. |
validateDateMinMax |
string |
<optional> |
'Please enter a date between {0} and {1}' | Date range validation message. |
validateDateCompare |
string |
<optional> |
'Please enter a date {0} {1}' | Date comparison validation message. |
validateDateToday |
string |
<optional> |
'today' | Compare with today. |
validateDateOther |
string |
<optional> |
'the other date' | Compare with another date. |
validateDateEQ |
string |
<optional> |
'equal to' | Equals operator. |
validateDateNE |
string |
<optional> |
'not equal to' | Not equals operator. |
validateDateLT |
string |
<optional> |
'before' | Prior to operator. |
validateDateGT |
string |
<optional> |
'after' | Following operator. |
validateDateLE |
string |
<optional> |
'not after' | Not prior to operator. |
validateDateGE |
string |
<optional> |
'not before' | Not following operator. |
- Source:
Methods
(inner) errorFormat(source, params) → {string}
Format a validation error message involving dates.
Parameters:
Name | Type | Description |
---|---|---|
source |
string | The error message, which may include substitution points, '{0}', '{1}', etc. |
params |
Array.<Date> | The dates, which are formatted with the current
dateFormat before being inserted
into the message at the indexed substitution point. |
- Source:
Returns:
The formatted message.
- Type
- string
Example
$.datepick.errorFormat(messages.validateDateMinMax, [minDate, maxDate])
(inner) errorPlacement(error, element)
Correct error placement for validation errors - after any trigger.
Parameters:
Name | Type | Description |
---|---|---|
error |
jQuery | The error message. |
element |
jQuery | The field in error. |
- Source:
Example
$('form').validate({
...,
errorPlacement: $.datepick.errorPlacement
})
(inner) selectDate(elem, target)
Trigger a validation after updating the input field with the selected date.
This function extends the
existing one
.
Parameters:
Name | Type | Description |
---|---|---|
elem |
Element | The control to examine. |
target |
Element | The selected datepicker element. |
- Source:
Example
$(selector).datepick('selectDate', $('div.datepick-popup a:contains(10)')[0])