These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Trouble getting a repeating dropdown in a table to populate with data.

StevenD
Registered: Oct 6 2006
Posts: 368

I'm having a little trouble getting part of the following code to work and I wonder if anyone can tell me why some of it isn't working or give me a clue to get it to work. Here is the code that I have commented out to play it safe.

/*
function getTeamMemberNames()
{
//Part A
TimeSheetSF.DetailsTable.Details.ItemNumber.rawValue = "";
TimeSheetSF.DetailsTable.Details.ItemNumber.clearItems();

//Part B
TimeSheetSF.EmployeeInfoSF.TeamMemNamesDrop.rawValue = "";
TimeSheetSF.EmployeeInfoSF.TeamMemNamesDrop.clearItems();

switch (xfa.event.newText)
{
case "Team 0":
TimeSheetSF.EmployeeInfoSF.TeamMemNamesDrop.addItem("Steven");
TimeSheetSF.EmployeeInfoSF.TeamMemNamesDrop.addItem("Jim");
break;

case "Team 1":
TimeSheetSF.EmployeeInfoSF.TeamMemNamesDrop.addItem("Carla");
TimeSheetSF.EmployeeInfoSF.TeamMemNamesDrop.addItem("Robert");
break;

default:
break;
}
}
*/

The part of the code that is not working is the part labeled Part A. Part B works just fine and puts the names in a dropdown field. Part is is trying to put the same names into a dropdown field that repeats in a table. I have always had trouble getting dropdown fields that repeat to be populated with a list.

I don't know if this is enough to go on but I have to start somewhere.

StevenD

StevenD

My Product Information:
LiveCycle Designer, Windows
StevenD
Registered: Oct 6 2006
Posts: 368
Well darn. I got it to populate the first dropdown but not all the other instances. I was hoping I could get all dropdowns in the table to populate with the same items using JavaScript but it just isn't easy to figure out. I'm a creative guy trying to work rocket science. It aint mixing right.

If anyone knows how to populate multiple instances of dropdowns using JavaScript kindly let me know it is done.

StevenD

hcorbin
Registered: Aug 11 2009
Posts: 57
Hi Steven,

Here is one way of populating the items of a dropdown field living in a repeating row named Details.

You can read the first line of script as ‘get the ItemNumber field of every Details row’. Use the method resolveNodes() to get a list of fields. Not to be confused with the method resolveNode (no ‘s’) that gets a single object. After that all you need to do is loop through the list of fields to manipulate each one individually.

var oItems = TimeSheetSF.resolveNodes("DetailsTable.Details[*].ItemNumber");var nLen = oItems.length; for (var i = 0; i < nLen ; i++){oItems.item(i).rawValue = "";oItems.item(i).clearItems(); switch (xfa.event.newText){case "Team 0":oItems.item(i).addItem("Steven");oItems.item(i).addItem("Jim");break; case "Team 1":oItems.item(i).addItem("Carla");oItems.item(i).addItem("Robert");break; default:break;}}

Hope this helps,

Hélène