Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#11547 closed defect (fixed)

InlineEditBox doesn't fire onChange on call to attr("value", ...)

Reported by: Stefan Bird Owned by: Douglas Hays
Priority: low Milestone: 1.6.1
Component: Dijit Version: 1.5
Keywords: Cc:
Blocked By: Blocking:

Description (last modified by bill)

If you call attr("value", ...) to set the value of an InlineEditBox, it does not fire an onChange event - onChange only get fired when save() is called.

var box = new InlineEditBox({onChange: function() { console.log("fired"); }});

box.attr("value", "New value");

Expected: "fired" written to the console

Actual: onChange() isn't called.

Change History (9)

comment:1 Changed 9 years ago by Douglas Hays

Owner: set to Douglas Hays

comment:2 Changed 9 years ago by Douglas Hays

Milestone: tbd1.6
Status: newassigned

comment:3 Changed 9 years ago by Douglas Hays

Resolution: fixed
Status: assignedclosed

(In [23295]) Fixes #11547. Add onChange support for programmatic set('value',...) calls, and add an automated test.

comment:4 Changed 9 years ago by mark007

Hi guys, has this bug crept back into the official 1.6. My inlineeditbox's don't have their onChange fired when I use dojo 1.6, they work perfectly with dojo 1.5.

I create them like

 var comment_text_edit = new dijit.InlineEditBox({
 id: "editbox_"+ap_com+"_"+dbid,
 autoSave: false,
 onChange: function (value)
 {
 //do x
 }
},comment_text);

comment:5 Changed 9 years ago by bill

Description: modified (diff)
Milestone: 1.61.6.1

Doug addressed in #12580.

comment:6 Changed 9 years ago by oes

Resolution: fixed
Status: closedreopened

this doesnt work at all. I have assigned an onChange handler but when clicking Save nothing happens. The onChange is not executed. http://pastebin.com/EdM6ehif

comment:7 Changed 9 years ago by oes

the culprit is this code snippet:

		if(this._started){
			// tell the world that we have changed
			setTimeout(dojo.hitch(this, "onChange", val), 0); // setTimeout prevents browser freeze for long-running event handlers
		}

this._started is "undefined"

comment:8 Changed 9 years ago by Douglas Hays

Resolution: fixed
Status: reopenedclosed

The committed fix works for me, and the supplied pastebin snip-it also works well on both 1.6 branch and trunk sources. The pastebin snip-it is invalid since it calls the asynchronous require and then instantiates the widget before giving the javascript time to load. So I just moved the require outside the addOnLoad and put it in the HEAD section. I also ran the test on both IE7 and FF4.

comment:9 Changed 9 years ago by Douglas Hays

BTW, I tested on trunk and 1.6 branch at revision [24313].

Note: See TracTickets for help on using tickets.