13
hi i am đang sử dụng plugin xác thực jquery.xác thực jquery, khi trường nhập có thuộc tính tiêu đề, thay vì tiêu đề thông báo lỗi được đưa ra dưới dạng thông báo lỗi
tôi có một vấn đề xa lạ, tôi có một validaion như thế này
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",
}
}
});
và 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");
lĩnh vực đầu vào của tôi là
<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>
nếu cityvalidation
thất bại. "You Have Typed Unallowed Charactors"
tin nhắn, nhưng thay vào đó tiêu đề của các trường được hiển thị.
- nếu tôi loại bỏ các tiêu đề nó hoạt động hoàn hảo. vì vậy những gì tôi suppoesed để làm. tôi muốn nhận được thông báo lỗi tùy chỉnh thay vì tiêu đề. xin vui lòng giúp đỡ ........
cảm ơn trước .....................