Skip to content

Manually trigger input validation

Geremia Taglialatela edited this page May 19, 2017 · 12 revisions

You can manually trigger validations in this way:

$input     = $('#validated_input');
$form      = $input.closest('form');
validators = $form[0].ClientSideValidations.settings.validators;

// Validate a single field
$input.isValid(validators);

// Validate the whole form
$form.isValid(validators);

It might not work for multiple inputs selected at once by $input.

To manually validate a single field, you may also trigger a focusout event: $('#validated_input').trigger('focusout');