Skip to main content

Bug Tracker

Side navigation

#4135 closed bug (invalid)

Opened February 12, 2009 11:38AM UTC

Closed October 12, 2009 11:41PM UTC

[validate] number validation method fails if first char is decimal

Reported by: ryan.rch Owned by:
Priority: major Milestone: 1.3.2
Component: plugin Version: 1.3.1
Keywords: validate plugin Cc:
Blocked by: Blocking:
Description

succeeds for '0.25' but fails for '.25'

I suggest modifying the regexp as such:

/^-?(\\d*|\\d{1,3}(?:,\\d{3})+)(?:\\.\\d+)?$/.test(value);

seems to work for me.

This site says to file with author, while author says to file here...

Attachments (0)
Change History (2)

Changed April 07, 2009 06:44PM UTC by mozingod comment:1

We're having the same issue. A slightly less intrusive fix for the regex would be to just replace the first one or more repeat matcher with the zero or more one:

original: /^-?(?:\\d+|\\d{1,3}(?:,\\d{3})+)(?:\\.\\d+)?$/

modified: /^-?(?:\\d*|\\d{1,3}(?:,\\d{3})+)(?:\\.\\d+)?$/

Changed October 12, 2009 11:41PM UTC by dmethvin comment:2

description: \ succeeds for '0.25' but fails for '.25' \ \ I suggest modifying the regexp as such: \ /^-?(\\d*|\\d{1,3}(?:,\\d{3})+)(?:\\.\\d+)?$/.test(value); \ \ seems to work for me. \ \ This site says to file with author, while author says to file here...succeeds for '0.25' but fails for '.25' \ \ I suggest modifying the regexp as such: \ /^-?(\\d*|\\d{1,3}(?:,\\d{3})+)(?:\\.\\d+)?$/.test(value); \ \ seems to work for me. \ \ This site says to file with author, while author says to file here...
resolution: → invalid
status: newclosed

This is not a jQuery core bug. Please report plugin bugs to the plugin's author, or ask on the jQuery forums. jQuery UI bugs should be reported on the UI bug tracker, http://dev.jqueryui.com .