Side navigation
#6342 closed enhancement (invalid)
Opened March 24, 2010 10:32AM UTC
Closed June 15, 2010 01:03AM UTC
[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;
}
},
Attachments (1)
Change History (1)
Changed June 15, 2010 01:03AM UTC by comment:1
resolution: | → invalid |
---|---|
status: | new → closed |
Not a jQuery core bug.