crystalens accomodating - Javascript function for validating date

Besides accepting all options as the non async validation function it also accepts two additional options; clean Attributes which, unless before resolving the promise and wrap Errors which can be a function or constructor that will be called with the errors, options, attributes and constraints if an error occurs.

They are meant to give a feeling for how to use the library and should not be considered production ready code.

The native HTML form validate has been disabled in a demo purpose so that you may see how works in action.

If the attributes objects is an HTML/DOM/j Query element Even though none of the built in validators are async it is sometimes useful to have async validations.

One example would be to check if a username is already used by asking the server.

If an is thrown from an async validator the argument passed to the rejection handler will be that error.

This allows you to differentiate from coding errors and validation errors.

The message can also be a function which will be called to retrieve the message, besides this it is treated like a normal message (the attribute name is prepended etc).

If the message is not a function and not a string it is simply returned as is.

Description: This script validates a date field to ensure it's in the format mm/dd/yyyy.

Tags: , ,