views:

310

answers:

2

Hi, I'm using jQuery and the minlength method for the validation plugin

rules: {
       checkboxes: {
            required:true,
                minlength: 3
        }
            }

This works how i want it to, BUT the error message I'm getting is "Please enter at least 3 characters." How do I instead say, "Please check at least 3 boxes"?

in the validate.js file, minlength looks like

minlength: $.format("Please enter at least {0} characters.")

Does it have something to do with the "$.format"? If not, how do I use this working method to create my own error message?

+2  A: 

After your rules, do:

messages: {
    checkboxes: {
        minlength: 'Please check at least 3 boxes.'
    }
}
chaos
Others, don't forget to add the comma. I used this code and was stumped for a long time as to why it wasn't working.
Ian McCullough
+1  A: 

you can add

messages: {checkboxes : {minlength: 'Please check at least 3 boxes'}}
Pharabus
hmm, my code does not show nice :(
Pharabus
you double code blocked it
Ian Elliott