notEmpty validator

Check if the value an is empty string


Using with form field

The HTML attributes are used to set the validator options via the Declarative plugin

Name HTML attribute Type Description
message data-fv-not-empty___message String The error message

Use 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 ES6 module


The MandatoryIcon plugin is useful when you want to display the mandatory icon for required fields

Basic example

In the following form, user is asked to enter the full name.

HTML5 example

When the Declarative plugin is used, the notEmpty validator will be turned on automatically if the input uses HTML 5 required attribute.

ES6 Module Example

The following snippet shows how to use the notEmpty validator with ES6 module:

More examples

Related validators

The following validators might be useful to you.