A Date instance can be created in Java Script by passing the date time string as the parameter in yyyy-mm-dd format as in Date(“2015-01-31”). If you pass an invalid date string, the Date instance would still be created.For instance, “2015-02-30” is not a valid date but the Date instance would still be created.
}, fn: function(r) { r.common(21); return r.message; } }, //Alternative uses of 'common' my Other Rule: { extend: "my Rule", fn: function(r) { r.common(42); return r.message; //"An Error" } }, //Only modify the 'message' my Third Rule: { extend: "my Rule", message: "A super bad error" } }); The form specific options prototypically inherit from the global options.
Since they aren't copied, any changes to the globals will propogate through to each validation form on the page.
These options can be changed using the Configure API above.
For example, the date range rule requires a start and an end date in order to begin validation. Group Scope is for reasonably rare cases when you are using the same group validation rule more than once in a single form.
For example, if you were to have two date validators on one form, you would use group scope to allow the library differentiate between the two.
Group validations are in the following format: name[.scope][#id][(args ...)] Try it out here: By default the error prompt will NOT be displayed on each member of the group, instead, only the field that triggered validation will display the message.
This can be overriden by instead returning a map of $.Rules({ my Rule: { message: "An error", common: function(n) { //a useful task...
For example, if for some strange reason, we wanted to check if a field is divible by 3, we can add a new rule Group validations are required when validation depends on two or more fields.
Useful for checking the combined result of a set of fields, such as a date range.
Group validations are defined in the same way as field (or single) validations, except you can provide two extra peices of optionally information: Group ID is generally required in most cases.
It will provide an easy way to tag given elements in the context of validation.