Bug Tracker

Opened 10 years ago

Closed 9 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;

}

},

Attachments (1)

jquery.validate.js (37.4 KB) - added by martypaz 10 years ago.
Modifications from line 894 to 921

Download all attachments as: .zip

Change History (2)

Changed 10 years ago by martypaz

Attachment: jquery.validate.js added

Modifications from line 894 to 921

comment:1 Changed 9 years ago by dmethvin

Resolution: invalid
Status: newclosed

Not a jQuery core bug.

Note: See TracTickets for help on using tickets.