Return true if the value contains only digits
| || ||String||The error message|
You don't need to do that when using HTML 5 required attribute.
If you want the field to be required based on particular field or conditions, look at the Conditional validation example.
Using with select element
If you want a select element to be required, you have to set
value="" for the option which is treated as empty one:
Using with WYSIWYG editor
Most of WYSIWYG (What You See Is What You Get) editors generate some HTML tags for an empty string. So, basically, you can't use notEmpty validator to validate a text area which uses a WYSIWYG editor.
Instead, use the callback validator to get the raw HTML string, and check if it's the default value generated by the editor, then it's empty field.
Looking at some examples below will give you the idea:
Showing mandatory icon
Showing mandatory icon for required field gives better user experience. You can do it with
In the following form, user is asked to enter the full name.
HTML 5 example
Below is an example of using HTML 5
required attribute to enable the notEmpty validator.
The following validators might be useful to you: