Validating data in javascript
26-Oct-2019 15:08
The attributes must be a plain object or a form element, things like backbone models etc are not supported.
For the format of the constraints see the constraints section.
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.
There is also a Travis project used for testing, a Coveralls project used to code coverage as well as the annotated source.
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.
This differs from example Ruby on Rails where validators instead have the option.
I find it quite common that you want to have constraints on an optional attribute.The validation constraints can be declared in JSON and shared between clients and the server. One thing that is a bit unorthodox is that most validators will consider undefined values (,) valid values.