Trigger plugin

Indicate the events which the validation will be executed when these events are triggered

Usage

By default, the field will be validated automatically when the input event is triggered. This plugin allows to set the specific events for given field as fllowing:

The sample code above assumes that the FormValidation files are placed inside the vendors directory. You might need to change the path depending on where you place them on the server.

Options

Option Type Description
event String or Object

Define the events. Can be one of the following formats:

threshold Number or Object

Only perform the validation if the field value exceed this number of characters. By default, it's set to 0.

This option does not effect to the elements which user cannot type, such as radio, checkbox, select one.

delay Number or Object

Pending validation for a given number of seconds after user stops filling in the field. By default, it's set to 0. It's really useful if the field needs to perform validation in server side, such as the remote validator.

Basic example

In the following form, the Title field will be validated while user type any character (trigger="keyup"). The Summary field will be validated when user lose the focus (trigger="blur").

Changelog

  • v1.1.0: Added new delay option
  • v1.0.0: First release

More examples