Opened 13 years ago

Closed 13 years ago

#10426 closed defect (wontfix)

Event management : onchange acts curiously

Reported by: sergei Owned by: sjmiles
Priority: high Milestone: tbd
Component: Dijit Version: 1.3.2
Keywords: onchange Cc:
Blocked By: Blocking:


if you consider : <input dojoType="dijit.Form.TextBox?" name="test" onchange="dojo.byId('myCounter').innerHTML=this.value.length;"

onkeyup="dojo.byId('myCounter').innerHTML=this.value.length;" >

<div id="myCounter" >

Text length


You would see that it works well with onchange event and not at all with onkeyup event. In either case, "this" designates the widget but it seems that some statement like :

this.value = this.focusNode.value;

has been applied previously in case of onchange event.

Nevertheless, you won't be able to set the value like that :

onchange="this.value='new text value';"

Although, neither would you do it with any other event.

I would say that onchange event acts curiously whereas we could expect the same behaviour for all events.


Change History (1)

comment:1 Changed 13 years ago by bill

Component: EventsDijit
Resolution: wontfix
Status: newclosed

As for setting the value, that's done via myWidget.attr("value", ...) (or this.attr("value") inside your event handler).

As for getting the value, myWidget.attr("value") is the official way and that might work better for you, please give it a try.

I'm not surprised that the (private) value attribute isn't updated on every keystroke, but you shouldn't be accessing that anyway.

Also, I think that if you want notifications on every keystrokes you should just set intermediateChanges=true and then use the onChange event.

Note: See TracTickets for help on using tickets.