Events on form components

Hi, I’m wondering if anyone knows if its possible to add events (other than click) to the components within a form. Specifically I’d like to be able to attach onAfterSelect to the popup on a list control. It doesn’t seem to throw up any errors but the event never fires. Is there any way around this?
Thanks, Richard.

for now, if you have

{ type:"list",id:'field_e', label: 'Type', value: "1", yCount:"3", data:[ { id:"1", value:"One" }, { id:"2", value:"Two" }, { id:"3", value:"Three" } ],template:"#value#"},

you can use

//id+"_list" $$("field_e_list").attachEvent("onAfterSelect", some);

Thanks for the quick response, I’m having trouble getting that solution to work however. When I try that example code I don’t get any response from the event at all. I’ve tried it both with an inline and seperate function on the current codebase but can’t seem to get any response. I also tried adding it to the sample form 01_init.html page incase it was something on the page itself but the same behavior there.

Also, if the name and id property of the list are the same it triggers the event on the page load which is odd. Any suggestions?

I’ve managed a workaround. It seems that the syntax is correct, only that the onAfterSelect won’t work with it at the moment. onItemClick however works just fine and works as a substitute for what I was trying to do.
Thanks again for the help.
Richard.

Hi,

This is also my intention :unamused:

But when I set up the form there is no id of list like “*_list”:

dhx.ui(
					{
						container: 'element_list', view: 'form', css: 'background_color', data:
						[
							{ type: 'list', id: 'mylist', label: 'Data: ', data: listData, labelWidth: 60, width: 200, sameLine: true }
						]
					});
					
					$$('mylist_list').attachEvent('onItemClick ', function()
					{	
						alert(arguments[0]);
					});

What is wrong? Thanks

Like you I had a bit of trouble with it when specifying external data in your example. In the end I used a bit of php to generate the data for my list in the declaration.