Attach event to multiselect

Hi@all,

there is a small issue attaching an event to a multiselect. Following situation.

My form definition:

<?xml version="1.0" encoding="UTF-8"?> <items> *muchstuffdeleted* <item type="multiselect" name="public_easements" inputHeight="150" inputWidth="205" connector="./lib/php/dhxComboConnector.php?comboID=public_easements" /> </item> </items>

Now I want to attach an event to this multiselect item:

[code]var select_public_easements;
dhtmlxEvent(window, “load”, function() {
/* dhxLayout - deleted */

			/* dhxMenu - deleted*/
		   	
			/* dhxLayout - cell a - dhxForm */
			dhxForm = new dhtmlXForm("dhxForm");
			dhxForm.setFontSize("inherit");
			dhxForm.loadStruct("./lib/xml/dhxFormSearch.xml", function() {
				/* do on form load */

				/* add events for public easements multiselect */
				select_public_easements = dhxForm.getSelect("public_easements");
				select_public_easements.attachEvent("onChange", function(){ valuationSearch(); });
			});

}); // end of dhtmlxEvent

[/code]

Doing this results in following message:

TypeError: 'undefined' is not a function (evaluating 'select_public_easements.attachEvent("onChange", function(){ valuationSearch(); })')

I have no idea, why I can’t attach the event this way. In serval other cases that works perfectly right.

Any idea :wink:

Edit: Full error message is:

[Error] TypeError: 'undefined' is not a function (evaluating 'select_public_easements.attachEvent("onChange", function(){ valuationSearch(); })') (anonymous function) (search.php, line 150) _xmlParser (dhtmlxform.js, line 26) check (dhtmlxcommon.js, line 11)

Hi
You just need to attach event to the form, not the select

Ok, got it :wink:
Thank you for your fast reply.

You are welcome!