Opened 11 years ago

Closed 11 years ago

Last modified 9 years ago

#7011 closed defect (fixed)

[patch] [cla] ValidationTextBox reset() doesn't reset field error message and status

Reported by: guest Owned by: bill
Priority: high Milestone: 1.2
Component: Dijit - Form Version: 1.1.1
Keywords: ValidationTextBox Cc:
Blocked By: Blocking:

Description (last modified by bill)

Problem:

  1. Have a ValidationTextBox in a Dialog
  2. Open the dialog
  3. Enter something invalid
  4. Error message is displayed
  5. Cancel and hide the dialog
  6. Re-open the dialog
  7. Error message and state is visible (i.e. not reset)

Solution: Overload the reset() method to reset the messages and state.

Notes: It would be nice if dijit.Dialog.show() reset the fields for you:

dojo.forEach(this.getDescendants(), function(w){
    if(w.reset){ w.reset(); }
});

-Chris Barber

Attachments (1)

ValidationTextBox reset.patch (384 bytes) - added by guest 11 years ago.

Download all attachments as: .zip

Change History (8)

Changed 11 years ago by guest

comment:1 Changed 11 years ago by bill

Description: modified (diff)

comment:2 Changed 11 years ago by bill

Owner: set to Douglas Hays

OK, there are two issues here:

  • ValidationTextBox.reset() doesn't clear the error state from the widget (i.e., it's still yellow)
  • enhancement for Dialog.show() to do a reset() (BTW it can just call this.reset() since Dialog extends Form).

comment:3 Changed 11 years ago by Douglas Hays

Owner: changed from Douglas Hays to bill

This is an enhancement request for Dialog. There probably needs to be a flag to reset or not since some Dialog's probably need persistence of values.
ValidationTextBox? already resets the error state.
Run dijit/tests/form/test_validate.html
Search for the "euro currency" textbox and enter some letters.
Press the Reset button and the error disappears.

comment:4 Changed 11 years ago by bill

Owner: changed from bill to Douglas Hays

Doug, I added this.reset() to Dialog.show() and it mostly works, but in test_Dialog.html, on the first dialog, the DateTextBox isn't cleared. Can you fix that?

I'm still thinking about whether there should be a resetOnShow widget attribute, or show() should take a reset flag, but in any case need to fix that DateTextBox problem.

comment:5 Changed 11 years ago by Douglas Hays

Owner: changed from Douglas Hays to bill

DateTextBox? reset problem fixed. Awaiting resolution on the resetOnShow attribute for the Dialog enhancement.

comment:6 Changed 11 years ago by bill

Resolution: fixed
Status: newclosed

OK, I don't think I'm going to add an automatic way for Dialog to reset at this point... developer can just call Dialog.reset() before calling Dialog.show(). The other part about ValidationTextBox (which is the main issue in this ticket) is already fixed, so closing.

comment:7 Changed 9 years ago by bill

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