0

I am running into a problem with jQuery Validation and need to ignore some fields.

I need to ignore hidden fields and array of input boxes using validation plugin.

Below is html code.

<form id="transport-form">
  <input type="text" name="qty[]" id="qty1">
  <input type="text" name="qty[]" id="qty2" style="display:none" >
  <input type="text" name="qty[]" id="qty3">
  <input type="text" name="qty[]" id="qty4">
  <input type="submit value="submit">
</form>

and jquery code is below

jQuery("#transport-form").validate({
        rules: {
            'qty[]': {
                required: true,
                ignore: '[],:hidden'
            }
        },
    });

I need to ignore [] because everytime i click submit it is validating only the first value. rest all the values of same name are not validated.

But i want ignore also hidden input (qty2) Please help.

3
  • Possible duplicate of How to validate array of inputs using validate plugin jquery Commented Nov 30, 2016 at 13:42
  • That incomplete solution does not solve my problem. Commented Nov 30, 2016 at 13:46
  • my problem is: How to concatenate array [] and :hidden simultaneously into ignore properties? Commented Nov 30, 2016 at 13:48

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.