1

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?

0

2 Answers 2

3

After your rules, do:

messages: {
    checkboxes: {
        minlength: 'Please check at least 3 boxes.'
    }
}
Sign up to request clarification or add additional context in comments.

1 Comment

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

you can add

messages: {checkboxes : {minlength: 'Please check at least 3 boxes'}}

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.