Javascript validating numeric input

That's why Parsley is here: to let you define your general form validation, implement it on the backend side, and simply port it frontend-side, with maximum respect to user experience best practices.

Parsley uses a specific DOM API which allows you to configure pretty much everything directly from your DOM, without writing a single javascript configuration line or custom function.

Please take 5 minutes of your time to have a quick glance at it, and at least understand the architecture (Parsley, Parsley Form, Parsley Field, Parsley Validator, Parsley UI, Utils, Pub/Sub..), it will heavily ease the lecture below. Parsley will parse the input's value and pass the date, or reject the value if it's not an acceptable date.

The format used must be that [of the standard](, e.g. Your custom validator must specify at least one of these.

Parsley comes with various error messages for its built-in validators.

They are shipped in English by default, but many other languages are available, thanks to the awesome international Parsley community. To load a different locale and its messages, include them after Parsley: The last loaded file will automatically set the messages locale for Parsley.

For performance reasons, Parsley does not use j Query events, but the API to listen to events is very similar: By default, all 2xx ajax returs are considered valid, all others failure.

Parsley is a decoupled library that uses different classes to do the heavy work.

You'll see here the different protagonists involved and how you can configure them to fit your desired validation.

Sometimes (when a call is needed to see if an email, a pseudo is available for example) a 404 API answer could be the right answer. You have access to the plugin as well as the element if you need to perform other actions before returning the validation result.

To learn how to craft your custom remote validators, go here.

Leave a Reply