Opened 13 years ago

Closed 13 years ago

Last modified 11 years ago

#8400 closed defect (wontfix)

intermediateChanges = false does not work on ValidationTextBox

Reported by: Pete Smith Owned by: Douglas Hays
Priority: high Milestone: tbd
Component: Dijit - Form Version: 1.2.3
Keywords: Cc:
Blocked By: Blocking:


it is false by default, but each keypress in the box fires validate no matter what I do. I am expecting it to only try to validate onChange, not each keypress. I am trying to validate the value via ajax call.

><div intermediateChanges="false" dojoType="dijit.form.ValidationTextBox" name="user_id" value="{$user.login_name}"

<script type="dojo/method" event="validate">
console.log('validate'); // fired each keypress


Change History (7)

comment:1 Changed 13 years ago by Pete Smith

After looking commenting out _refreshState: function(){ this.validate} on line 149 of ValTextBox? does this - why is it being so aggressive to validate?

comment:2 Changed 13 years ago by Adam Peller

Component: GeneralDijit
Owner: changed from anonymous to Douglas Hays

comment:3 Changed 13 years ago by bill

intermediateChanges controls how often onChange is called, as documented in the api doc.

validate() is called on every keystroke by design, so that errors are caught as soon as possible. What makes you think there's a bug here?

comment:4 Changed 13 years ago by Pete Smith

bill maybe this isn't the widget for me - this is the case I am hoping to fufill:

user types a value, blurs out of the field, and the value is sent to the server, and a message returned and displayed if it doesn't validate. Each keypress in this case adds tons of overhead, since I just want to validate when they leave the field. When the containing form (a _formMixin ) is submitted, the isValid should be callable from the parent with validate(), and a message displayed in case it is bad (it can resend thats not bad). Is this widget just not suited for this?


comment:5 Changed 13 years ago by bill

Resolution: wontfix
Status: newclosed

Yah, sorry, you might be able to make that happen but ValidationTextBox is not designed to work that way so it doesn't come out of the box. You could connect to _onBlur() or _onChange() and send the value to the server then. But you wouldn't really beusing any of the code in ValidationTextBox so you might as well you TextBox or a custom widget?

The other issue is that there only one Tooltip that can be displayed on the screen at a time (the MasterTooltip), and for TextBox/ValidationTextBox it only displays when you are focused on the widget. Not sure if you wanted to use a tooltip or just print a message somewhere on the screen, but if you want to use a Tooltip then you need to consider that too.

comment:6 Changed 13 years ago by Pete Smith

Thanks bill I see after wrasslin with it for a day. I made a gq.form.ServerValidationTextBox? that inherits from val text box, but removes some of the onkeypressness attachpoints and overrides a few methods to get what I wanted. It seems like a nice addition, since not all things can be validated server side, but I want it to work in conjunction with the "validate()" api that the formmixin calls when you submit the form. Generally speaking , I supply an isValid method in dojo ml <script> block that makes my ajax call , sets the invalidMessage (which is in the response) and returns true or false. I just had to add some defense around the setValueAttr and focus methods to not have it do constant server requests when setting or typing. I wont say its perfect, but seems to work and would make a nice addition to the dijit.form. Once you use ValTextBox? and dig its whole look and feel, it seems natural to add this extension. I have code but I can't tell you I know how it works entirely, the inheritance model here is deep.

comment:7 Changed 11 years ago by bill

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