Opened 11 years ago

Closed 11 years ago

Last modified 9 years ago

#8580 closed defect (fixed)

[patch] [cla] dijit.form.ValidationTextBox shows message despite being reset and refocused

Reported by: cb1kenobi Owned by: Douglas Hays
Priority: high Milestone: 1.3
Component: Dijit - Form Version: 1.2.3
Keywords: ValidationTextBox isValid isValidSubset hasBeenBlurred Cc:
Blocked By: Blocking:

Description

This is similar to #7011, but what happens what happens:

  1. Have a dijit.form.ValidationTextBox? in a Dialog
  2. Show the dialog, the form is reset
  3. Cancel and hide the dialog
  4. Re-open the dialog
  5. State is "", but the message in tooltip is still displayed

I think this is an easy fix. When the validate() function is fired, have isValid or isValidSubset take into account this._hasBeenBlurred.

The idea is after a dijit.form.ValidateTextBox? is reset, we have to assume it is the same state as if it was loaded the first time in which case we need to assume that the default value is valid since the user hasn't entered anything yet. this._hasBeenBlurred tells us the field has been touched and thus we need to take that flag into account.

I'm not 100% sure that this patch is going to not break anything else. I need someone who knows more about this code to take a peek.

Attachments (2)

ValidationTextBox message.patch (727 bytes) - added by cb1kenobi 11 years ago.
validationtextbox_test.html (1.4 KB) - added by cb1kenobi 11 years ago.

Download all attachments as: .zip

Change History (10)

Changed 11 years ago by cb1kenobi

comment:1 Changed 11 years ago by bill

Owner: set to Douglas Hays
Summary: [patch] dijit.form.ValidationTextBox shows message despite being reset and refocused[patch] [cla] dijit.form.ValidationTextBox shows message despite being reset and refocused

comment:2 Changed 11 years ago by Douglas Hays

I'm unable to recreate this. I added a reset() call to the onblur handler in test_Dialog.html's first Dialog and I was unable to see a tooltip that shouldn't be there. Can you attach a small testcase, or perhaps describe the recreate steps using test_Dialog.html?

comment:3 Changed 11 years ago by cb1kenobi

I've attached a simple test case. Put the file in the same folder as dojo, dijit, and dojox. You may need to tweak the paths.

Simply open the dialog and immediately close the dialog. Then reopen the dialog and the tooltip with the errorMessage is visible.

If you apply my patch, then this._hasBeenBlurred will be set to false when the dialog is visible and this is used to indicate the dialog has just opened.

Changed 11 years ago by cb1kenobi

Attachment: validationtextbox_test.html added

comment:4 Changed 11 years ago by cb1kenobi

Correction, I meant the "invalidMessage" attribute, not "errorMessage".

comment:5 Changed 11 years ago by Douglas Hays

Owner: changed from Douglas Hays to bill

reset() is not being called. I guess that's by design so that users can have persistent values. Maybe we need a new boolean attribute for Dialog to control this? Another option would be for Dialog to tell the form widgets to reset just _hasBeenBlurred but leave the values (soft reset?).

comment:6 Changed 11 years ago by Douglas Hays

Owner: changed from bill to Douglas Hays
Status: newassigned

comment:7 Changed 11 years ago by Douglas Hays

Resolution: fixed
Status: assignedclosed

(In [16574]) Fixes #8580. Reinitialize _maskValidSubsetError on reset().

comment:8 Changed 9 years ago by bill

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