Skip to Content
avatar image
Former Member

Populate field1 in table, based on dropdown value of a field2 in same row

Hi Experts,

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.

Regards,

Neha

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Best Answer
    avatar image
    Former Member
    Feb 22, 2012 at 06:10 PM

    Hi Neha,

    I hope you have the stand alone non SAP flavour of Adobe LiveCycle Designer 9 installed locally.

    If yes, please follow the following post -

    [http://forums.adobe.com/message/2481839#2481839]

    It has a sample solution attached - you will probably do a similar thing.

    Because you probably shall have more data - it makes sense to have some sort of an hidden table with the Employee Name and Employee Code in it. While using Java scripting, convert the hidden table entries into 2 - D array and try to change the Employee ID drop down based on change of Employee Name Drop Down.

    Let me know of your progress.

    Regards,

    Rohit

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 17, 2012 at 06:41 AM

    Hi Neha,

    What you need to do is :

    make both of the fields as drop down list.

    Then on exit event(javascript) of EMP_NAME put

    j=xfa.form.form name.subform name.Emp_Name.selectedIndex;

    xfa.form.form name.subform name.Emp_Code.selectedIndex = j ;

    Hope this will help.

    Regards,

    Subhasish

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      HI Neha ,

      I am new to Java script..

      I am also facing a problem like i have material description(MAKTX) as drop down on the form. when the user wants to change the material description(MAKTX) need to change the corresponding Unit of measure(MEINS) and Standard packing(UMREN).

      Please can you help me for this..

      Regards

      Krish

  • avatar image
    Former Member
    Feb 23, 2012 at 01:53 AM

    Hi Rohit,

    Thanks for your reply.

    I have Adobe LiveCycle Designer version 8 on my machine. Do I need to upgrade to version 9?

    I went through the link you sent me, however when I import the sample form into SAP, I can't see the context or binding for these drop-downs. I had a look at the javascript behind the combo box, there are statements like - countryScript.getStatesOther(xfa, stateProv);

    I don't have such methods or scripts written in my scenario, any pointers on sample code or how can I get this to work.

    Regards,

    Neha

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Feb 24, 2012 at 05:06 AM

    Hi Rohit,

    Thanks for this. I downloaded the standalone version of LiveCycle Designer and could view the code. This is very useful.

    I have another issue though. The code in this example is using a 2d array. All the values have been hard-coded in this list. My data is however dynamic and comes from the calling program.

    If I can convert the array with fixed data into a dynamic one with data being read from the tables in the context, I can re-use the rest of the code with alterations to suit my requirement.

    Any idea of how I can integrate this code with the data from the Context.

    Regards,

    Neha

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      HI Rohit ,

      I am new to Java script..

      I am also facing a problem like i have material description(MAKTX) as drop down on the form. when the user wants to change the material description(MAKTX) need to change the corresponding Unit of measure(MEINS) and Standard packing(UMREN).

      Please can you help me for this..

      Regards

      Krish