Return the validity from a callback method
* — Required option
| || ||Function||The callback method|
| || ||String||The error message. The dynamic message is supported|
The callback method must follow the format below:
If you want to return a dynamic message, the callback function must return an object containing the
Look at the dynamic message example.
In the following form, user is asked to enter a correct answer of simple operation which is generated randomly.
The captcha is also generated after form submission by triggering the err.form.fv event.
Dynamic message example
The form below ask to enter a secure password, which must satisfies all the following conditions:
- Must be more than 8 characters long
- Must contain at least one upper case character
- Must contain at least one lower case character
- Must contain at least one digit
Showing all messages
It's also possible to show all the messages initially. Then whenever the password passes a particular rule, the message associated with the rule will disappear.
Again, we need to trigger events to archive this. This time, the field events (
success.field.fv) are used.
- Asking fields to be unique
- Building a password strength meter with Dropbox's zxcvbn libary
- Contact form
- Preventing user to have same value as the placeholder
- Supporting multiple date formats
- Terms and conditions agreement validation
- Validating international phone numbers
- Validating percentage values
The following validators might be useful to you: