Opened 9 years ago

Closed 8 years ago

Last modified 8 years ago

#17340 closed defect (invalid)

ValidationTextBox.validate() method does not mark field invalid

Reported by: Eric Martin Owned by: Douglas Hays
Priority: undecided Milestone: tbd
Component: Dijit - Form Version: 1.9.1
Keywords: Cc:
Blocked By: Blocking:


When I call validate() on a ValidationTextBox? that is invalid, it returns false, but it does not show the exclamation mark and error message tooltip.

Attachments (1)

testpage.html (1019 bytes) - added by Eric Martin 9 years ago.

Download all attachments as: .zip

Change History (11)

Changed 9 years ago by Eric Martin

Attachment: testpage.html added

comment:1 Changed 9 years ago by bill

Component: GeneralDijit - Form
Owner: set to Eric Martin
Status: newpending

Why are you calling validate() at all? You shouldn't need to.

comment:2 Changed 8 years ago by Eric Martin

Status: pendingnew

I have a subsection of a form that needs to take an action. When the action is triggered, all the fields in that section need to be validated before proceeding. I cannot use form.validate() because the rest of the form does not have to be valid for that particular action. From what I have read, ValidationTextBox?.validate() is the best way to approach this.

Thanks, Eric

comment:3 Changed 8 years ago by bill

Owner: changed from Eric Martin to Douglas Hays
Status: newassigned

comment:4 Changed 8 years ago by Douglas Hays

Resolution: invalid
Status: assignedclosed

The error icon isn't shown until the field has been focused at least once. Otherwise the field would show invalid as soon as the page is loaded. validate() checks this condition by default.

comment:5 Changed 8 years ago by Eric Martin

This doesn't fit the general use case of when certain form fields need to be validated that haven't been focused on (see previous comments). This case is taken into consideration on the dijit/form/Form.validate() method which validates all fields regardless of focus history.

comment:6 Changed 8 years ago by Eric Martin

I'm not sure if these comments are reviewed after the ticket is closed. If I haven't heard back I will open another ticket to have the above comment considered.

comment:7 Changed 8 years ago by Douglas Hays

All comments are considered. Any new tickets would be closed as dups.

comment:8 Changed 8 years ago by Eric Martin

In that case I won't open a new ticket. I'll just wait until you have a chance to respond to this one.

comment:9 Changed 8 years ago by freddefisk

I have done a similar thing and solved this by setting the _hasBeenBlurred property to true for all input fields prior to calling validate, just like it's done in dijit/form/Form.

comment:10 Changed 8 years ago by Eric Martin

Thanks freddefisk! That's what I needed, it worked like a charm. Do you think it would be beneficial to others to add a second optional parameter similar to 'ignorePreviousFocus' which if true would set the _hasBeenBlurred field to address this situation or is this an infrequent issue? Also, I'm not sure if the isFocused parameter is meant to accomplish this.

Thanks again!

Note: See TracTickets for help on using tickets.