Skip to content

Manually trigger input validation

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

Option 1

$('#validated_input').change().focusout();

Option 2

$input = $('#validated_input');
$form = $input.closest('form');

$input.data('changed', true);
$input.isValid($form[0].ClientSideValidations.settings.validators);

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

It also works with the whole form by calling $form.isValid($form[0].ClientSideValidations.settings.validators); instead.

Gem version 9.3.1