Side navigation
#4419 closed enhancement (invalid)
Opened March 25, 2009 02:29PM UTC
Closed October 13, 2009 12:22AM UTC
[validate]
Reported by: | lewismc | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | |
Component: | plugin | Version: | |
Keywords: | validate addMethod | Cc: | |
Blocked by: | Blocking: |
Description
Contribution to addMethod:
Default Value
If a default value is used in the form, by way of the title attribute, this method will check that the field value is not equal to that value, therfore will not validate if is.
jQuery.validator.addMethod(
"defaultVal",
function(value, element){
if (jQuery(element).val() != jQuery(element).attr('title')) {return true;} return false;
},
"Please enter a value"
);
Line:
if (jQuery(element).val() != jQuery(element).attr('title')) {return true;} return false;
Should be:
return (jQuery(element).val() !== jQuery(element).attr('title')) ? true : false;