jQuery-Validation-Engine icon indicating copy to clipboard operation
jQuery-Validation-Engine copied to clipboard

Inputs with empty value and custom validation can never display error message

Open markstahler opened this issue 14 years ago • 1 comments

I have some fairly complicated validations for my form. One being that if an input is empty, the partner input cannot and vice versa. The issue I have run into is when one of the inputs is filled in and the other forgotten, no error is displayed on the empty input and validation continues (despite my custom validation sending an AlertText).

This line is buggering it up for me:

// If the rules required is not added, an empty field is not validated if(!required && field.val() == "") options.isError = false;

Can you think of a way around this? I really prefer to have the validation message on the empty form input.

markstahler avatar Dec 20 '11 20:12 markstahler

you will need to implement a custom validator for these types of checks. please refer to the doc and samples.

sincerely,

orefalo avatar Dec 21 '11 09:12 orefalo