Override defaults with $.fn.validatebox.defaults.
The validate rule is defined by using required and validType property, here are the rules already implemented:
To custom validate rule, override $.fn.validatebox.defaults.rules that defines a validator function and invalid message. For example, to define a minLength valid type:
Now you can use the minLength validtype to define an input box that should be inputed at least 5 characters:
Name | Type | Description | Default |
---|---|---|---|
required | boolean | Defines if the field should be inputed. | false |
validType | string | Defines the field valid type, such as email, url, etc. | null |
missingMessage | string | Tooltip text that appears when the text box is empty. | This field is required. |
invalidMessage | string | Tooltip text that appears when the content of text box is invalid. | null |
Name | Parameter | Description |
---|---|---|
destroy | none | Remove and destroy the component. |
validate | none | Do the validation to determine whether the content of text box is valid. |
isValid | none | call validate method and return the validation result, true or false. |