Opened 12 years ago

Closed 11 years ago

Last modified 8 years ago

#4760 closed defect (fixed)

dijit.form.DateTextBox validation wrong?

Reported by: guest Owned by: Douglas Hays
Priority: blocker Milestone: 1.0
Component: Dijit - Form Version: 0.9
Keywords: Cc:
Blocked By: Blocking:

Description

Web Browser(version) :InternetExplorer(6.0.2800.1106),FireFox(2.0.0.7)
Dojo Widget :dijit.form.DateTextBox
File :dijit/tests/form/Form.html

I typed '05/02/30' on DateTextBox,
'2005/2/30' doesn't exist,
but,Input value doesn't invalidated!!

Attachments (3)

Form2.png (32.7 KB) - added by guest 12 years ago.
4760.patch (755 bytes) - added by haysmark 12 years ago.
Fixes #4760. Added parse() test to ValidationTextBox? validator (unparseable values are not valid).
4760.2.patch (777 bytes) - added by haysmark 12 years ago.
Fixes #4760. Added parse() test to ValidationTextBox? validator (unparseable values are not valid).

Download all attachments as: .zip

Change History (16)

Changed 12 years ago by guest

Attachment: Form2.png added

comment:1 Changed 12 years ago by Adam Peller

Owner: changed from anonymous to Adam Peller
Status: newassigned

hmm... somehow we regressed so that it's only running the regexp and not actually checking the date. thanks for catching this.

comment:2 Changed 12 years ago by Adam Peller

(In [10880]) it's not a problem with date, and the validation tests pass. strangely this bug seems limited to DateTextBox? in Forms? Refs #4760

comment:3 Changed 12 years ago by Adam Peller

Owner: changed from Adam Peller to Douglas Hays
Status: assignednew

comment:4 Changed 12 years ago by Adam Peller

Component: GeneralDijit

comment:5 Changed 12 years ago by haysmark

So just to clarify, 05/02/30 refers to May 2 1930, not 2005/2/30.

comment:6 Changed 12 years ago by Adam Peller

Nope, that was locale:ja where they use yy/mm/dd. The problem can be reproduced in en-us locale by entering 2/30/05

Changed 12 years ago by haysmark

Attachment: 4760.patch added

Fixes #4760. Added parse() test to ValidationTextBox? validator (unparseable values are not valid).

comment:7 Changed 12 years ago by haysmark

Wait that breaks blank values. Just needs a slight tweak to get those working.

Changed 12 years ago by haysmark

Attachment: 4760.2.patch added

Fixes #4760. Added parse() test to ValidationTextBox? validator (unparseable values are not valid).

comment:8 Changed 12 years ago by haysmark

So this second patch seems to work. Adam, like you said there wasn't a problem in the date parser; there was just no call to the parser in the validation code.

comment:9 Changed 12 years ago by Adam Peller

Resolution: fixed
Status: newclosed

(In [10910]) Make sure to parse the value in validator, not just run it through the regexp. Thanks, haysmark! Fixes #4760

comment:10 in reply to:  description Changed 11 years ago by guest

Resolution: fixed
Status: closedreopened

Replying to guest:

Web Browser(version) :InternetExplorer(6.0.2800.1106),FireFox(2.0.0.7)
Dojo Widget :dijit.form.DateTextBox
File :dijit/tests/form/Form.html

I typed '05/02/30' on DateTextBox,
'2005/2/30' doesn't exist,
but,Input value doesn't invalidated!!

comment:11 Changed 11 years ago by Douglas Hays

Resolution: fixed
Status: reopenedclosed

(In [11822]) Fixes #4760. A bad parse now returns undefined instead of null.

comment:12 Changed 11 years ago by Adam Peller

makes me wonder if this is one of those less-is-more times where the less precise "if (foo)" would be better than explicitly checking !== null or !== undefined? parse either returns a Date or it doesn't.

comment:13 Changed 8 years ago by bill

Component: DijitDijit - Form
Note: See TracTickets for help on using tickets.