jQuery Validation Plugin Question

jQuery Validation Plugin Question
0

#1

Hi,

I use jQuery Validation Plugin: https://jqueryvalidation.org/rules/

I want to add my messages but It don’t work for me,i don’t know what i’m doing wrong.

$('#myform').validate({    
    rules: {
        text_first: {
            minlength: 4,
            maxlength: 15,
            required: true
        },
        text_second: {
            minlength: 4,
            maxlength: 15,
            required: true
        },
        text_third: {
            minlength: 4,
            maxlength: 15,
            required: true
        },
        text_fourth: {
            minlength: 4,
            maxlength: 15,
            required: true
        },
        text_fourth: {
            minlength: 4,
            maxlength: 15,
            required: true
        },
        text_five: {
            minlength: 4,
            maxlength: 15,
            required: true
        },
        text_six: {
            minlength: 4,
            maxlength: 15,
            required: true
        },
        text_seven: {
            minlength: 4,
            maxlength: 15,
            required: true,
        },
        messages: {
          minLength: "lower than 5!"
        },
    },
    highlight: function(element) {
        $(element).closest('.form-group').removeClass('has-success').addClass('has-error');
        $(element).siblings(".input-group-addon").children("i").removeClass('glyphicon-ok').addClass('glyphicon-remove');
    },
    unhighlight: function(element) {
        $(element).closest('.form-group').removeClass('has-error').addClass('has-success'); 
        $(element).siblings(".input-group-addon").children("i").removeClass('glyphicon-remove').addClass('glyphicon-ok');
        // success=1
    },
    errorElement: 'span',
        errorClass: 'help-block',
        errorPlacement: function(error, element) {
            if(element.length) {
                error.insertAfter($(element).closest('.input-group'));
            } else {
            error.insertAfter(element);
            }
        } 
 });

So,i’m add this:
minLength: “lower than 5!”
But it don’t work for minLenght,because I get “standard” error for minLenght:
“Please enter at least 4 characters.”

But I don’t want standard messages,I want mine.


#2

Can you provide a link to your project, so we can review all the code and check for other possible errors?

Thank you.