Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

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

Avatar

Avatar
Validate 1
Level 2
past-tense
Level 2

Likes

9 likes

Total Posts

85 posts

Correct Reply

10 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
Applaud 5
View profile

Avatar
Validate 1
Level 2
past-tense
Level 2

Likes

9 likes

Total Posts

85 posts

Correct Reply

10 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
Applaud 5
View profile
past-tense
Level 2

26-09-2014

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

Accepted Solutions (0)

Answers (1)

Answers (1)

Avatar

Avatar
Boost 50
MVP
_Bruce_Robertson
MVP

Likes

269 likes

Total Posts

1,782 posts

Correct Reply

372 solutions
Top badges earned
Boost 50
Boost 5
Boost 3
Boost 250
Boost 25
View profile

Avatar
Boost 50
MVP
_Bruce_Robertson
MVP

Likes

269 likes

Total Posts

1,782 posts

Correct Reply

372 solutions
Top badges earned
Boost 50
Boost 5
Boost 3
Boost 250
Boost 25
View profile
_Bruce_Robertson
MVP

26-09-2014

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