Opened 12 years ago

Closed 12 years ago

Last modified 8 years ago

#5971 closed defect (fixed)

DateTextBox does not always show an error with required=true

Reported by: Douglas Hays Owned by: haysmark
Priority: high Milestone: 1.1
Component: Dijit - Form Version: 1.1b1
Keywords: Cc:
Blocked By: Blocking:

Description (last modified by haysmark)

Run test_DateTextBox.html
Click on the 2nd textbox and the calendar popup appears. Select a date.
Erase all text in the same textbox w/o loosing focus.
Tab or click away and there's no error even though the field is required and the onChange should probably show undefined or blank.

Attachments (1)

5971.patch (825 bytes) - added by haysmark 12 years ago.
Fixes #5971. Focus manager sets _hasBeenBlurred to true on widgets it blurs.

Download all attachments as: .zip

Change History (6)

comment:1 Changed 12 years ago by haysmark

Description: modified (diff)
Summary: ComboBox does not always show an error with required=trueDateTextBox does not always show an error with required=true

Seems that validation only happens while the calendar is open.

comment:2 Changed 12 years ago by haysmark

Furthermore, this bug only happens the first time. If you repeat the procedure after you get the error state, it works as expected.

comment:3 Changed 12 years ago by haysmark

This is an order of operations bug in ValidationTextBox?. The ValidationTextBox? template invokes _onMouse onblur, before focus manager calls Widget's _onBlur. But the error handling in validate(), which is triggered by _onMouse, checks to see if _onBlur has been called yet:

this.state = (isValid || (!this._hasBeenBlurred && isEmpty)) ? "" : "Error";

Hence, when you delete all of the text from a ValidationTextBox? for the first time, it doesn't matter whether a blank value is valid or invalid because we have allowed blank values to be valid the first time through. The code expects _onBlur to fire first, but this is not the case.

Changed 12 years ago by haysmark

Attachment: 5971.patch added

Fixes #5971. Focus manager sets _hasBeenBlurred to true on widgets it blurs.

comment:4 Changed 12 years ago by Douglas Hays

Resolution: fixed
Status: newclosed

(In [12695]) Fixes #5971 !strict. Proxy commit for haysmark. Focus manager sets _hasBeenBlurred to true on widgets it blurs.

comment:5 Changed 8 years ago by bill

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