Bug Tracker

Modify

Ticket #2660 (closed bug: invalid)

Opened 5 years ago

Last modified 14 months ago

[validate] range values are read incorrectly from markup

Reported by: etal Owned by:
Priority: major Milestone: 1.2.4
Component: unfiled Version: 1.2.1
Keywords: validate Cc:
Blocking: Blocked by:

Description

When assigning ranges (and rangelength) through markup ,for example:

<input id="days" name="days" class="range required" type="text" range="[1,99]" />

the range is interpreted as a string and not an array leading to incorrect validation and inability to submit form.

Attachments

jquery.validate.js.patch Download (482 bytes) - added by etal 5 years ago.
patch to evaluate string if needed

Change History

Changed 5 years ago by etal

patch to evaluate string if needed

comment:1 Changed 5 years ago by scott.gonzal

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

Setting up validation via attributes is only supported for validation methods that expect strings or numbers as their parameters.

To setup range validation set min and max via attributes and use the autoCreateRanges option.

comment:2 Changed 3 years ago by sadgit

  • Status changed from closed to reopened
  • Resolution invalid deleted

This is a simple and appropriate fix - why was this rejected?

comment:3 Changed 3 years ago by sadgit

Simply insert the following line

if (typeof rules === 'string') rules[this] = eval(rules[this]);

comment:4 Changed 3 years ago by dmethvin

  • Status changed from reopened to closed
  • Resolution set to invalid
  • Component changed from plugin to unfiled

This is not a jQuery core bug. Please use the plugin's support channel (such as the forums or the plugins page) to request features or report bugs.

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.