Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session

Problem with populating dynamic drop down

Avatar

Level 2

I am hoping someone can help.

I have a process that is retrieving a series of codes from a table. It generates an XML which I have bound to a text field on the form. For testing, the field is visible and I can see the XML when I run it.

However the code that I am using to populate the drop down is not working.

I'm ot sure if I have done somethin wrong in the process or in the form.

The XML in the field looks like:

<?xml version="1.0"?>

<xdp>

     <datasets>

          <data>

               <form>

                    <Page1>

                         <type>

                              <assignedOther>

                                   <code>

                                        <CD type="CHAR">ES</CD>

                                   </code>

                                   <code>

                                        <CD type="CHAR">EX</CD>

                                   </code>

                                   <code>

                                        <CD type="CHAR">NF</CD>

                                   </code>

                              </assignedOther>

                         </type>

                    </Page1>

               </form>

          </data>

     </datasets>

</xdp>

In the JavaScript of the form I have:

var parsedOther = new Array();

var taxtypeXML = XMLData.parse(form.Page1.type.assignedOther.rawValue, false);

var otherList = XMLData.applyXPath(taxtypeXML, "//code[*]/CD");

if (otherList.length){

     for (var i = 0; i < otherList.length; i++){

          parsedOther.push(otherList.item(i).value);

     }

}else{

     if (otherList.value){

          parsedOther.push(otherList.value);

     }

}

parsedOther.sort();

otherExpl.setItems(parsedOther.toString());

assignedOther if the text field that has the XML and otherExpl if the drop down fiend.

2 Replies