hi i am using jquery validation plugin .
i have a strange issue , i have a validaion like this
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",
}
}
});
and 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");
my input fields are
<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>
if the cityvalidation
failed . "You Have Typed Unallowed Charactors"
message , but instead of that the titles of the fields are shown .
thanks in advance .....................
hmmm i found it .
i used 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",
}
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With