0

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 Answer 1

6

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

"vraag2[]": "Make at least one choice"
Sign up to request clarification or add additional context in comments.

Comments

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.