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.

populating pulldown from xml

Avatar

Level 3

Hello:

I have a requirement that 4-5 different fields need to have a way to read from  XML file to popluate on load.  I've seen some examples, but I need some answers to get a firm grasp.

1.  Does the XSD or XML document have to contain all the fields from the form or can the file only contain the fields that need to be prepopulated?

2. What should be the binding method on all the other fields that are not prepopulated?

If you can provided examples with xml files it would be greatly appreciated.

Thanks for your assistance.

9 Replies

Avatar

Former Community Member

Depends what you are trying to accomplish. If you want to export data out of the form, then the binding is important, and all fields that you want to contain in the xml data must be bound. If you only want to import data inot the form for pre-population then only the fields that you want to pre-pop need to be in the inbound data. All other data will be preserved but not bound to the form.

Hope that helps.

Paul

Avatar

Level 10

You can only bind selective fields to XML data source. And those fields that you do not want to bind, make their binding as "None"..

You need to create a data source with XML/ XSD.. And then bind those selective fields to them.

Hope this helps..

Thanks

Srini

Avatar

Level 3

can you point me to somewhere that has some examples for me to look at?

Avatar

Level 3

I have a very simple form with one field on it.  I have a xml document  that looks something like the following....

<?xml version="1.0" encoding="UTF-8"?>
<List>
  <Item>
   <Text>Bozo 1</Text>
   <Text>Bozo 2</Text>
   <Text>Bozo 3</Text>
   <Text>Bozo 4</Text>
  </Item>
</List>

I want the form to read in the data and display it in the pulldown.  However, when I attempt to setup the binding and data connection to the Xml file.  It does not display anything in the pulldown.  Nor does it give any errors.  I would upload the form, but the site is not allowing that at this time.

Avatar

Level 3

you should have it in your email....

Avatar

Level 10

Even though you selected the XML tag in the dynamic properties of the dropdown, you missed to set the Item Text and Item Value properties..

Just select these properties and you should be able to have the values populated..

DropDown Dynamic Properties.jpg

Thanks

Srini

Avatar

Level 3

Srini:

Thanks for the information, that solved that problem. However, now when I selected from the LiveCycle Designer menu File->Distribute Form.....  Then I take the form and pull it up in reader it no longer populates the fields even though the xml file is in the same directory.  Is their another step that I'm missing to keep the files linked?  The end user needs to be able to edit the XML at any time to add additional items to the pulldown.

Thanks

Avatar

Level 10

The user needs to import the XML file to PDF inorder for it to display the data. Form can not load the XML file directly. It has to be done by the user interaction. You can place a button (Call it "Import") or any other event after the user opens it, write the following script to ask the user to select the XML file.

     //Try it by placing in a Click event of the Button with Java Script as Language.

     xfa.host.importData();

The above method only works in Acrobat. If you want to work it in Reader also, then you need to Reader Extend the form. (Open the PDF in Acrobat and goto Advanced menu -> Extend Features in Adobe Reader and Save the file.

Thanks

Srini