开发者

Jquery Validate name="name[]" not working

开发者 https://www.devze.com 2023-01-15 21:43 出处:网络
I\'m using the Validation plugin from bassistance.de I want to validate the folowing: <form class=\"cmxform\" id=\"form1\" action=\"ufm/mailit.php\" method=\"post\">

I'm using the Validation plugin from bassistance.de I want to validate the folowing:

<form class="cmxform" id="form1" action="ufm/mailit.php" method="post">
<fieldset>
<inp开发者_StackOverflow中文版ut type="checkbox" value="namea" name="name[]" id="namea" /> <label for="namea">Name a</label>
<input type="checkbox" value="nameb" name="name[]" id="nameb" /> <label for="nameb">Name b</label>
<input type="checkbox" value="namec" name="name[]" id="namec" /> <label for="namec">Name c</label>
<button type="submit" id="RegisterButton" name="ButtonValue" value="Aanvragen">Submit</button>
</fieldset>
</form>

And using this javascript:

$(document).ready(function() {
        $("#form1").validate({
            rules: {

                vraag2[]: {required: true, minlength: 1}
                         },

            messages: {
                vraag2[]: "Make at least one choice"
            }
        });
});

But it's not working, It has to do with the [] characters how can I use those characters with the validation plugin?

Thanks!

Edski


Names in JavaScript object literals must be quoted if they contain non-alphanumerics (or are keywords):

"vraag2[]": "Make at least one choice"
0

精彩评论

暂无评论...
验证码 换一张
取 消