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.

XML assistance with drop downs

Avatar

Level 1

Hello All,

I'm pretty new to creating forms in LiveCycle, and just started dabbling with the XML side.  What I am trying to accomplish is populating  a drop-down list based on the selection from a prior drop-down list.

I found a document in the help files that describes exactly what I want to do using the following xml:

      <country/>
      <countries>
          <item uiname="United States" token="US"/>
          <item uiname="Vietnam" token="SRV"/>
     </countries>
     <state/>
     <US>
          <item>California</item>
          <item>New York</item>
          <item>Texas</item>
     </US>
     <SRV>
          <item>An Giang</item>
          <item>Bac Giang</item>
          <item>Bac Kan</item>
     </SRV>

I understand the xml above and how to create my lists based on it, I just don't know where I put it.  Does this go directly into the XML Source in LiveCycle, or do I have to create my own .xml file?  If it is the latter, is there any additinal formatting that needs to go into the .xml file, such as versioning and encoding, etc?

Also, how do I get this into my PDF once the file is created if it is a .xml file.

Thanks,

Zak
3 Replies

Avatar

Former Community Member

Normally XML like that is returned from a web service call that is made by the form. If you intend on laoding it when the form is loaded then you are asking your users to import it (this can be automated to a point) but the user will have to choose the file. You might find it better to hardcode your values into the form if you do not have an external data source (like a web service call) that will supply this information. If you look at the Dynamic Interactive Purchase Order sample that ships with th eproduct you will see this done with arrays in Javascript for the countries of USA and Canada, then the Province/State DDlist get spopulated with the appropriate values.

Hope that helps

Paul

Avatar

Level 1

Ok, I finally got this working, but I ran into another odd issue once it started working.

1. I created a .xml file tailored to the fields on my form and the list items I needed.

2. Created a new data source pointing to the xml file, and set my preview settings to the xml file.

3. Linked the fields to their appropriate data sources.

     -At this point it still was not working.

4. I went back and added the <?xml version="1.0" encoding="UTF-8"?> line to the beginning of my xml file.

     -All the drop downs started working and populate as intended.

Here is where it went wrong.  My form has two drop-downs from which I pull data, "Model" the main list, and "Model Sleeve" which populates based on the first.  All of a sudden, the field title next to the "Model" drop-down is gone in the PDF preview, there is just a white space where it should say "Model". Both the caption and binding name fields are labeled "Model".

Here is an example of my xml.

<MyData>
    <Model/>
    <Models>
         <item uiname="Drop down 1 item" token="REE"/>
    </Models>
    <ModelSleeve/>
    <REE>
        <item>option1</item>
        <item>option1</item>
        <item>option1</item>
    </REE>
</MyData>

Thanks for the assistance.

Zak

Avatar

Level 1

I decided to go the javascript route from the sample you mentioned.  Everything is working great now, thanks for the help.

Zak