Подтвердить что ты не робот

Jquery validation, когда поле ввода имеет атрибут title, вместо заголовка сообщения об ошибке указывается как сообщение об ошибке

Привет, я использую плагин проверки jquery.

У меня странная проблема, у меня есть validaion вроде этого

jQuery("#profile_info").validate({

    rules : {
        city : {
            required : true,
            minlength : 3,
            maxlength : 30,
            cityvalidation: true
        },
        state : {
            required : true,
            minlength : 3,
            maxlength : 30,
            cityvalidation: true
        }
    },
    messages : {
        city : {
            required : " City must be  filled in",
            minlength : "At least 3 characters long",
            maxlength : "Should not exceed 30 characters",
        },
        state : {
            required : " State must be  filled in",
            minlength : "At least 3 characters long",
            maxlength : "Should not exceed 30 characters",
        }
    }
});

и cityvalidation

jQuery.validator.addMethod("cityvalidation", function(value, element) {
      return this.optional(element) || /^[a-zA-Z\u0080-\u024F\s\/\-\)\(\`\.\"\']+$/i.test(jQuery.trim(value));
    }, "You Have Typed Unallowed Charactors");

мои поля ввода

                                                    <div class="select-date-container-side location-codes">
                                                        <input id="city" name="city"
                                                            value="<?php if(isset($profileinfo['CityName'])){echo $profileinfo['CityName'];}else if(isset($city)){echo $city;} ?>"
                                                            title="City" type="text"
                                                            class="smaler-textfield textfield clear-default"
                                                            tabindex="1900" />
                                                    </div>
                                                    <div class="select-date-container-middle location-codes">
                                                        <input id="state" name="state"
                                                            value="<?php if(isset($profileinfo['StateName'])){echo $profileinfo['StateName'];}else if(isset($state)){echo $state;} ?>"
                                                            title="State" type="text"
                                                            class="smaler-textfield textfield clear-default"
                                                            tabindex="1900" />
                                                    </div>

если сбой cityvalidation. "You Have Typed Unallowed Charactors", но вместо этого отображаются названия полей.

enter image description here

  • Если я удалю заголовок, он отлично работает. так что я хотел сделать. Я хочу получить собственное сообщение об ошибке вместо заголовка. пожалуйста, помогите........

заблаговременно.....................

4b9b3361

Ответ 1

Хммм я нашел его.

Я использовал ignoreTitle: true,

jQuery("#profile_info").validate({


    ignoreTitle: true,

    rules : {
        city : {
            required : true,
            minlength : 3,
            maxlength : 30,
            cityvalidation: true
        },
        state : {
            required : true,
            minlength : 3,
            maxlength : 30,
            cityvalidation: true
        }
    },
    messages : {
        city : {
            required : " City must be  filled in",
            minlength : "At least 3 characters long",
            maxlength : "Should not exceed 30 characters",
        },
        state : {
            required : " State must be  filled in",
            minlength : "At least 3 characters long",
            maxlength : "Should not exceed 30 characters",
        }
    }
});