Bug Tracker

Modify

Ticket #4419 (closed enhancement: invalid)

Opened 4 years ago

Last modified 4 years ago

[validate]

Reported by: lewismc Owned by:
Priority: minor Milestone:
Component: plugin Version:
Keywords: validate addMethod Cc:
Blocking: Blocked by:

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"

);

Change History

comment:1 Changed 4 years ago by pbcomm

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;

comment:2 Changed 4 years ago by dmethvin

  • Status changed from new to closed
  • Resolution set to invalid

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.