Use Promise to validate value
Using with form field
* presents a required option. The HTML attributes are used to set the validator options via the Declarative plugin
| || ||String||The error message|
| || ||String or Function||The callback returns promise instance|
promise option must be a function or the name of function which returns a Promise as following:
The following form asks user to upload an avatar which both width and height must be less than 300px.
TipUse the file validator if you want to validate size of an image
They can be determined using Promise as seen in the following snippet:
When the field is validated completely, we can get the custom data stored in the result's
The following validators might be useful to you.