Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

How do I get the selected value of a drop down whose items are generated at runtime?

Avatar

Level 4

I've been at this all day, with no luck.

I have a drop down whose values are generated at runtime via javascript on the Enter event. This code generates the list of items from another repeatable subform in the document:


this.clearItems();



var vItems = xfa.resolveNodes("People.Person[*]");


for(i=0; i<vItems.length; i++)


{


  var name = vItems.item(i).DisplayName.rawValue;


  if (name != null)


  {


    this.addItem(name);


  }


}


This works perfectly. I can select any of the "DisplayName"s listed under the repeatable "Person" subform.

My problem is that it seems dynamically generating the possible values like this prevents me from reading the rawValue of the drop down. For example, I put the following in a button ("PersonName" is the dynamic drop down I'm working with):


xfa.host.messageBox(PersonName.rawValue);


When I click the button, nothing happens. if I point it at a different drop down that had their items defined statically within the GUI, the message box pops up and shows the current value, as expected.

The same goes for selectedIndex, boundItem, and pretty much everything else I've tried. What makes it stranger is that I'm still able to programatically set the rawValue... i.e.:

PersonName.rawValue = "Test";

What am I doing wrong here? I've even enabled debugging and watched for any exceptions... nothing. Any code I write that tries to read from a drop down whose values are generated at run time just doesn't seem to execute.

I would appreciate any help that you guys might be able to offer. Thanks!

-Scott

1 Reply

Avatar

Level 10

Hi Scott,

I don't know what could be causing the problem, I have not had any problems referencing values from a programmatically loaded drop down list.  Can you share your form? (host it somewhere, like google docs, and add a link to it in this thread)

Regards

Bruce