Opened 13 years ago
Closed 13 years ago
#6342 closed enhancement (invalid)
[validate] Additional feature for watermarking plugins
Reported by: | martypaz | Owned by: | |
---|---|---|---|
Priority: | Milestone: | 1.4.3 | |
Component: | unfiled | Version: | 1.4.2 |
Keywords: | [validate] | Cc: | |
Blocked by: | Blocking: |
Description
I have made a modification to the plugin to allow for the use of watermark plugins such as focusmagic.. It will check the LABEL FOR value and compare it to the current field value and pass/fail accordingly
Hopefully you can look at implementing it somehow (maybe with better error handling)
http://docs.jquery.com/Plugins/Validation/Methods/required
required: function(value, element, param) {
See if we have a label set by a watermark plugin var thelabel = $('label[for=' + element.id + ']');
check if dependency is met if ( !this.depend(param, element) )
return "dependency-mismatch";
switch( element.nodeName.toLowerCase() ) { case 'select':
could be an array for select-multiple or a string, both are fine this way var val = $(element).val(); return val && val.length > 0;
case 'input':
if ( this.checkable(element) )
return this.getLength(value, element) > 0;
default:
if(thelabel) {
if(thelabel.text() == $.trim(value)) {
Label (watermark value) is the same as the field value return false;
}
} return $.trim(value).length > 0;
}
},
Modifications from line 894 to 921