How to trigger only one specific custom validation? Let's say I have three custom validation methods:
$.validator.addMethod('customValidation1', function (data)
{
}, 'Error');
$.validator.addMethod('customValidation2', function (data)
{
}, 'Error');
$.validator.addMethod('customValidation3', function (data)
{
}, 'Error');
Insted of calling all of them, how can I trigger just customValidation1 without triggering customValidation2 and customValidation3.
Calling something like this$("#id").valid(); is triggring all of them.
Quote OP:
I don't see how that is possible. Did you somehow assign all three custom rules to the
#idfield? Otherwise, fields can not automatically pick up any of your custom rules without a programmatic declaration.Let's assume that the field with the
name="field_name"also hasid="field_name".Calling something like
$("#field_name").valid()will only evaluate thecustomValidation2method along with any other rules or methods as declared in the.validate()example above.