Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.
SOLVED

Fill a drop down from another drop down.

Avatar

Former Community Member

Hi...

I have a hidden drop down field whose values are being filled from a web service response.

I have to fill another drop down based on these values.

Just needed some guidance in the following script...

// DD1-> Drop Down list 1 and DD2 -> Drop downlist 2

var count = DD1.length;

for (var i = 0; i < count; i++)

{

     xfa.resolveNode("IN_TAB.DATA[" this.parent.index "]").DD2.addItem(DD1.items[i].value);

}

The part

DD1.items[i].value

is not working .. How do I access a drop down value based on index? I have tried different combinations but havent found a proper solution.. Should I be using an array instead? I know I am missing out on something really silly

Any help would be appreciated...

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

First you should not need to resolve the node as Acrobat/Reader will work with the objects in the same container.

The property you are looking for is "getDisplayItem":

var nItems = DD1.length;

for (var i=0; i<nItems; i++)

{

     this.addItem(DD1.getDisplayItem(i));

}

Have a look at this example: http://assure.ly/jcTahK. Look at the middle example.

Hope that helps,

Niall

PS: This script is in the preOpen event of DD2.

View solution in original post

3 Replies

Avatar

Correct answer by
Level 10

Hi,

First you should not need to resolve the node as Acrobat/Reader will work with the objects in the same container.

The property you are looking for is "getDisplayItem":

var nItems = DD1.length;

for (var i=0; i<nItems; i++)

{

     this.addItem(DD1.getDisplayItem(i));

}

Have a look at this example: http://assure.ly/jcTahK. Look at the middle example.

Hope that helps,

Niall

PS: This script is in the preOpen event of DD2.

Avatar

Former Community Member

Thanks a lot Niall..

As freaky as it may sound, I knew that you would answer this question.. That is why a few minutes ago I had queried this forum with your name followed by 'Drop-Down' and stumbled across this.. http://adobe.hosted.jivesoftware.com/thread/859148 And the next thing was you answering this question, which was really freaky

Thanks again..

Avatar

Level 10

You're welcome - glad I could help

Niall