Populate field1 in table, based on dropdown value of a field2 in same row
I have created an offline interactive Adobe form and need help with java-script on events. I will describe my scenario below -
I have written an SE38 report program which will generate the PDF. To pre-populate fields in the PDF, I have a structure Default_Values which has a few internal tables. One of the internal tables Employees has 2 fields Emp_Code and Emp_Name. I have written code to obtain a list of employees and populate this internal table Empoyees. I call the Adobe form and along with other parameters, pass this structure Default_Values. Thus all the default values along with the internal table Employees pre-populated with the Employee Code and Employee Names have been passed to the Context.
In the Adobe form I have a table with 10 lines with Employee details (6 columns, 2 of which are Emp_Code and Emp_Name)
In this table control, the column Employee Name is a drop down list. For this column, under List Items, I have created a binding to the internal table Employees with default values. This binding Items looks like this - $record.DEFAULT_VALUES.EMPLOYEES.DATA[*] with Item Text and Item Value having the value EMP_NAME.
When I test the form, I can see all the Employee Names in the drop down list in the column Employee Name of the table control.
My requirement is that when a user selects an Employee Name from the drop-down list, the field Emp_Code for that row in the table control should be automatically populated with the corresponding value of Emp_Code depending on the Emp_Name which the user has selected.
I am new to Java-scripts and Adobe forms. I have searched this and other forums, however I couldn't find the right code which I can place in either the Change or Exit event of the drop-down to accomplish this.
Can someone please provide me with sample code to achieve this.
Any help will be greatly appreciated.
Thanks in advance.