add event to one item on my form

HI all,

I have a form with an input field and an select field.

The select field is filled with info using an xml file. This one is called “Report_Number”
The event should fire a grid.load() and then setting the value of the first cell into the input field on the form.

The event I use is myForm.attachEvent(“onChange”, function() {} );

Everything works fine but when I change the text in the input field the event is fired again and the original text is set in the inputfield.
This is indeed normal behavior because the event is for the complete form.

How can I set the event so it only works when the user change another “Report_Number” from the select field.

If possible could you explain it with an example? or refer me to an example?

Have a nice day.

Please, check the name of the changing field in your onChange event, so you will perform your custom action only for the required field:
myForm.attachEvent(“onChange”, function(name, value) {
if(name==“Report_Number”){
do_smth()
}
else
//do_nothing
} );

That was the solution. thx alot.
Only I did not use the value, what does it do?

myForm.attachEvent(“onChange”, function(naamItemOpForm){

		[b]if(naamItemOpForm=="report_num"){ [/b]
		
			report_Num = myForm.getItemValue("report_num" );
			numberReport = report_Num; // het gekozen report nummer gebruiken als zogezegd een nieuw nummer.
			if (report_Num == "0"){
				myForm.setItemValue("name","");
				myForm.setItemValue("shortDesc","");
				myForm.setItemValue("url","");
				myForm.setItemValue("owner","");
				myForm.setItemValue("email","");
				myForm.setItemValue("cc","");
				myForm.uncheckItem("form_v_cpn");
				myForm.uncheckItem("form_l_cpn");
				myForm.setItemValue("descriptionNL","");
				myForm.setItemValue("descriptionFR","");
				mode = "insert";
				numberReport = onthoudenNumberReport; // terug zetten van de oorspronkelijke nieuwe report nummer
			}
			
			myTabbar.tabs("tab_hidden").show();
			grid_hidden.clearAll();
			grid_hidden.load("*****?p_ID=" + report_Num);
			
			grid_hidden.attachEvent("onXLE",function(){ myForm.setItemValue("name",grid_hidden.cellById(1,0).getValue());
														myForm.setItemValue("shortDesc",grid_hidden.cellById(1,1).getValue());
														myForm.setItemValue("url",grid_hidden.cellById(1,2).getValue());
														myForm.setItemValue("owner",grid_hidden.cellById(1,3).getValue());
														myForm.setItemValue("email",grid_hidden.cellById(1,4).getValue());
														myForm.setItemValue("cc",grid_hidden.cellById(1,5).getValue());
														vcpn = grid_hidden.cellById(1,6).getValue();
														lcpn = grid_hidden.cellById(1,7).getValue();
														if (vcpn == "Y"){myForm.checkItem("form_v_cpn"); } else {myForm.uncheckItem("form_v_cpn");}
														if (lcpn == "Y"){myForm.checkItem("form_l_cpn"); } else {myForm.uncheckItem("form_l_cpn");}
														myForm.setItemValue("descriptionNL",grid_hidden.cellById(1,8).getValue());
														myForm.setItemValue("descriptionFR",grid_hidden.cellById(1,9).getValue());
														
														grid_hidden.forEachRow(function(id){
														// deze vars zijn nodig omdat de combobox index vanaf 0 start.
																groupId = grid_hidden.cellById(id,10).getValue() - 1;
																userId = grid_hidden.cellById(id,11).getValue() - 1;
																subtopicId = grid_hidden.cellById(id,12).getValue() - 1;
														
														// aanvinken welke er zijn geselecteerd															
																combo_group.setChecked(groupId,true);
																combo_user.setChecked(userId,true);
																combo_subtopic.setChecked(subtopicId,true);
														});

													});
			
			mode = "update";

// myForm.detachEvent(onChangeEvent);

		}	
			
		});

Only I did not use the value, what does it do?
It is not a mandatory to use the value parameter. In some cases you need to perform some special action on selecting some specific option. So you can get the value of that selecting option.