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.

values ​​loading XML file

Avatar

Level 4

Hello I have the following xml file loaded into a pdf

my xml file is structured in this way:

<root>

     <list>

          <field code="A">

               <field1 code="100"  />

          </field>

          <field code="B">

               <field1 code="200"  />

          </field>

     </list>

</root>

In the first drop downlist I was able to load the field values ​​(A, B, etc.)

  following this tutorial: http://forms.stefcameron.com/2006/07/29/dynamic-properties/

works well

the problem I have now is how do I load in a second drop downlist, the values (100, 200) ​​from the xml file according to the choice made before?


3 Replies

Avatar

Level 8

There are a number of ways. Normally values wouldn't be stored as attributes as is in your case, so I find it easiest to use XPath instead of accessing the attribute through the scripting object model.

Put this in the change event of your first drop down where DropDownList2 is the name of your second dropdown:

DropDownList2.rawValue=null;

var elements = XMLData.applyXPath(xfa.data,"root/list/field[@code='"+xfa.event.newText+"']/*/@code");/**/

DropDownList2.clearItems();

if (elements.className=="dataValue")

DropDownList2.addItem(elements.value);

else{

for (var a=0;a<elements.length;a++)

  DropDownList2.addItem(elements.item(a).value);

}

Kyle

Avatar

Level 4

Hello thanks for the help, as soon as I get some time I try to use the code

Avatar

Level 4

hello I tried the code, unfortunately it does not work properly.
The first code example value = "100" is not taken.

Another thing, through a service LCES, I transform my workbench using XDP file in an HTML page the code to populate the drop down list does not work