#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: |
Description
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)
Change History (11)
Changed 8 years ago by
Attachment: | testpage.html added |
---|
comment:1 Changed 8 years ago by
Component: | General → Dijit - Form |
---|---|
Owner: | set to Eric Martin |
Status: | new → pending |
comment:2 Changed 8 years ago by
Status: | pending → new |
---|
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
Owner: | changed from Eric Martin to Douglas Hays |
---|---|
Status: | new → assigned |
comment:4 Changed 8 years ago by
Resolution: | → invalid |
---|---|
Status: | assigned → closed |
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
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
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
All comments are considered. Any new tickets would be closed as dups.
comment:8 Changed 8 years ago by
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
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
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!
Why are you calling validate() at all? You shouldn't need to.