Skip to main content

Bug Tracker

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)
  • jquery.validate.js (37.4 KB) - added by martypaz March 24, 2010 10:34AM UTC.

    Modifications from line 894 to 921

Change History (1)

Changed June 15, 2010 01:03AM UTC by dmethvin comment:1

resolution: → invalid
status: newclosed

Not a jQuery core bug.