Opened 12 years ago

Closed 12 years ago

#4236 closed defect (fixed)

Combo box and onchange event handler issues

Reported by: guest Owned by: haysmark
Priority: high Milestone: 1.0
Component: Dijit Version: 0.9
Keywords: Combo Box Cc:
Blocked By: Blocking:

Description

Hi, I am encountering the following issues regarding combox box and a registered onchange handler.

  1. the onchange event is fired when the page (and the combo box) is first rendered. This leads to weird behavior if there are multiple combo boxes on one screen that have event handler attached that execute ajax requests...
  2. on firefox, the event handler does not get the event object passed in, thus handler working with the given event object fail due to nullpointer exceptions

Change History (6)

comment:1 Changed 12 years ago by bill

Milestone: 1.0
Owner: set to Douglas Hays

comment:2 Changed 12 years ago by Douglas Hays

Owner: changed from Douglas Hays to haysmark

comment:3 Changed 12 years ago by haysmark

Well, it's definitely getting the value in Firefox. The grey textboxes in test_FilteringSelect prove this:

http://archive.dojotoolkit.org/nightly/checkout/dijit/tests/form/test_FilteringSelect.html

comment:4 Changed 12 years ago by guest

That's correct BUT the event object does not get passed in. So if you have function:

function myFunc(evt){

do s.th. with the event

}

and register it on the widget via onchange="myFunc(event)" the event object is undefined when the function gets invoked. On the other hand, if you do the same on a normal HTML <select> element, the event gets passed in. As originally described, this problem does not occur on IE but firefox.

comment:5 Changed 12 years ago by bill

Do this:

onChange="myFunc"

comment:6 Changed 12 years ago by haysmark

Resolution: fixed
Status: newclosed

Right, asking onchange for something called event does not make sense because dojo is really overriding the default onchange. The result is none of your arguments are named. I believe in several examples we refer to arguments[0] because of this.

On the other hand, by using bill's code and passing a function pointer, you avoid all of these issues.

Note: See TracTickets for help on using tickets.