Validating phone number javascript

is an open source component of Wrapp and is licensed under the MIT license.

There are no required external dependencies at all!

Sometimes it's nice to be able validate field differently depending on the input itself.

validating phone number javascript-54validating phone number javascript-16

One core value of this library is that nothing should be private or inaccessable.

If you want to modify which values are considered empty for example you can simply overwrite You can find some basic examples included in the project.

You can use the async validate function even if no validations are async, it still returns a promise.

You can not, however, use the regular function with async validations.

Unless otherwise specified you can always specify the message option to customize the message returned if the validator doesn't pass.

Just remember to not include the attribute name since it's automatically prepended to the error message.

The implementation is fairly basic and doesn't do anything clever with the messages.

It doesn't support things like only validating a sub key if the parent key is present so for more advanced validations multiple validation schemas are recommended. Most validators allow you to specify default messages in addition to default options, refer to the documentation for the individual validators for information on how to do this.

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.

Though for the datetime and date validator to you need to specify a parse and format function and for that you most likely will want to use a library, is highly recommended.