ZK - Open Source Ajax Java FrameworkZK - Open Source Ajax Java Framework

Combo Box OnChange() Issue

sandhya123
18 Aug 2011 04:21:04 GMT
18 Aug 2011 04:21:04 GMT

<zk:combobox id="box" width="150px" onChange="getNetType(self.selectedItem.id);">
----------
void getNetType(val)
{
alert("Value-->>"+val);
}

Can any one tell me why the above code is not working?

When iam using the code which is below its wrkg(alert is generating) but its not passing to script.
<zk:combobox id="box" width="150px" onChange="alert(self.selectedItem.id);">

Could any one plz solve this issue
Thanks in advance,
Sandhya

twiegandTop Contributor
18 Aug 2011 10:44:41 GMT
18 Aug 2011 10:44:41 GMT

Sandhya.

This code seems to work for me:

<zk>
	<zscript>
		void getNetType(val){
			alert("Value-->>"+val);
		}
	</zscript>
	<combobox id="box" width="150px" onChange="getNetType(self.selectedItem.id);">
		<comboitem id="id1" label="label1" value="value1"/>
		<comboitem id="id2" label="label2" value="value2"/>
		<comboitem id="id3" label="label3" value="value3"/>
	</combobox>
</zk>

You might also consider using the onSelect event instead of onChange for the combobox.

Is that what you are trying to achieve?

Todd

sandhya123
22 Aug 2011 03:38:44 GMT
22 Aug 2011 03:38:44 GMT

Thanks for ur reply..ill try it once again

sandhya