#5327 closed defect (fixed)
v1.0 TextBox cannot set onfocus & onblur events declaratively
Reported by: | guest | Owned by: | Douglas Hays |
---|---|---|---|
Priority: | high | Milestone: | 1.1 |
Component: | Dijit - Form | Version: | 1.0 |
Keywords: | TextBox | Cc: | |
Blocked By: | Blocking: |
Description
With v.1.0 dijit.form.TextBox?, cannot set onfocus and onblur events declaratively. With v.1.0 dijit.form.ValidationTextBox?, cannot set onblur event declaratively.
/* line1 */ dojo.connect(dojo.byId("txt1"), "onfocus", func); /* line2 */ dojo.connect(dojo.byId("txt3"), "onblur", func); <input type="text" dojoType="dijit.form.TextBox" id="txt1" /> // WORKS WITH line1 <input type="text" dojoType="dijit.form.TextBox" id="txt2" onfocus="alert('focus')" /> // DOES NOT WORK. NOT WITH _onfocus <input type="text" dojoType="dijit.form.TextBox" id="txt3" /> //WORKS WITH line2 <input type="text" dojoType="dijit.form.TextBox" id="txt4" onblur="alert('blur')" /> //DOES NOT WORK. NOT WITH _onBlur
Change History (7)
comment:1 Changed 13 years ago by
Milestone: | → 2.0 |
---|---|
Owner: | set to Douglas Hays |
comment:3 Changed 13 years ago by
Milestone: | 1.3 → 1.1 |
---|
comment:4 Changed 13 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
(In [12572]) Fixes #5327 #5907 !strict. Add onFocus and onBlur hooks to all widgets inheriting from dijit._Widget. Refactored existing _onBlur and _onFocus methods to call this.inherited. Added example user-defined onfocus/onblur methods to a sampling of widget unit tests. Renamed widget event methods like onfocus and onkeyup that will collide with user-defined event handlers.
comment:5 Changed 13 years ago by
comment:6 Changed 13 years ago by
comment:7 Changed 10 years ago by
Component: | Dijit → Dijit - Form |
---|
Note: See
TracTickets for help on using
tickets.
Hi. That's true, we haven't exposed all the possible callbacks from the native form widgets. Partly because there are a lot of callbacks (onfocus, onblur, onselect, onchange, onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmousemove, onmouseout, onkeypress, onkeydown, onkeyup) and it would bloat our code size a lot to add them all.
In this case you can do what you did, connecting to the input node's onfocus and onblur events, or also you can connect to the *widget's* _onFocus and _onBlur events.
I suppose that onfocus and onblur are the most important events for an input widget (besides onchange), so I guess we should expose those. Marking for consideration in 2.0.