cancel
Showing results for 
Search instead for 
Did you mean: 

How to add drop down list into a repeating group

Former Member
0 Kudos

Hi experts,

we need a solution how to add drop down lists into repeating groups. We are using the LifeCycle Designer. Here is an example:

A form is used to collect the role of persons. The "role" shall be a drop down containing the following entries:


<roles>
   <role>
      <roleID>1</roleID>
      <roleValue>Engineering</roleValue>
   </role>
   <role>
      <roleID>2</roleID>
      <roleValue>Consulting</roleValue>
   </role>
</roles>

The data model of the persons is like the following:


<persons>
   <person>
      <name></name>
      <role></role>
   </person>
   ... (more persons)
</persons>

Now the problem:

I created a form containing a sub-form with the person's data. I added the binding to the $record.persons.person[*] and set the check mark "Repeat Subform for Each Data Item". So I get a list of the persons. Until here everything works great. Now each "person sub form" shall contain the drop down box containing the mentioned "role" values. Here is the problem.

The drop down box of the first person only shows the first value (here "Engineering"), the second drop down the second value (here "Consulting") and so on. What is the solution for this problem?

An idea was to set the values of each drop down dynamically using Java Script in the "initialize" event of each drop down box:


// clear the list
this.clearItems();
// get the data node of the roles
var roleDataNode =  --> get the data node of the "roles"
// get the number of the roles (here 2)
var numberOfRoles = --> how to get it?
// loop over the roles
for (var i = 0; i < numberOfRoles; i++)
{
   // get the ID of the role
   roleID = --> how to get it?
   // get the value of the role
   roleValue = --> how to get it?
   // add the roleID and the value to the drop down list
   this.addItem( roleID, roleValue  );
}

Now the summary of the questions:

- Is there a possibility to add a drop down box further times into a repeating sub form?

- How to get the data node of the roles (see pseudo code)?

- How to get the number of roles based on the data (see pseudo code)?

- How to get the role ID?

- How to get the role Value?

- How to set ID / value into the drop down box showing value?

Hope you have the answers.

Thank you very much and take care,

Thomas

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Just add a dynamic value set to the drop down box. The PDF does automatically the rest (translate the code into the text of the value set).

Example:

PERSON_NUMBER = 1

Dynamic Value Set:

1 = Peter

2 = Geroge

Dropdown shows Peter and writes back 1.

Regards,

Thomas

Former Member
0 Kudos

Dear Thomas,

could you post the solution of your problems?

Thanks in advance!!

norbert

Former Member
0 Kudos

Solved by my own. Thanks.