views:

22

answers:

1

Hi,

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>
<input 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

+1  A: 

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

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