I have a combobox for which I have a validation that a change in selection should be reverted back on meeting a condition.
I have detected the condition but when I change the value and displayedValue of combobox, the onChange associated with the combobox gets fired. Following is the code I am using to change the selection:
dijit.byId('scheduleName').set('value',val,false);
dijit.byId('scheduleName').set('displayedValue',displayVal,false);
I have also tried to set the onChange to blank before firing above code and then re attaching the onChange code as below:
dojo.connect(dijit.byId('scheduleName'),'onChange','');
dijit.byId('scheduleName').set('value',scheduleNameVal,false);
dijit.byId('scheduleName').set('displayedValue',trim(String(scheduleNameName)),false);
dojo.connect(dijit.byId('scheduleName'),'onChange', "hideGrid");
hideGrid is a javascript function. I am using Dojo 1.8
You should use
dojo.disconnectinstead ofExample:
As a side note,
connect/disconnecthas been deprecated in favor ofdojo/onhttps://dojotoolkit.org/reference-guide/1.8/dojo/on.html#dojo-on