1
votes

i am trying to validate my form fields calling the input text ids, but jquery is not validating it. here is what i have:

email2: {// compound rule required: true, email: true
},

if i change name="email2" it works fine, but i want name="email[]" as i have an array of email that i am getting from user. so then, i gave my input text and id for jquery to validate but it doesnt validate, any ideas?

1
This makes no sense as is. Please post more code (preferably all of it) so we have some idea of what is happening, then you may get some helpful answers. - Mark Bell
i think the rules are made to be keyed in as name not id, per the response below. thanks anyways. - NULL

1 Answers

1
votes

The rules are meant to be keyed by name, not id.

Something like this might work for you...

$("#form").validate({
    rules: {
        "email[]" : { /* compound rule */ }
    }
});