Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

How to embed an xml initial data in adobe LC form for dropdown controls.

Avatar

Avatar
Validate 25
Level 3
Mrsunilg-3z0lTX
Level 3

Likes

7 likes

Total Posts

295 posts

Correct Reply

9 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Boost 5
Boost 3
View profile

Avatar
Validate 25
Level 3
Mrsunilg-3z0lTX
Level 3

Likes

7 likes

Total Posts

295 posts

Correct Reply

9 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Boost 5
Boost 3
View profile
Mrsunilg-3z0lTX
Level 3

19-09-2016

Hi Developer,

I want to perform a POC to embed and Keep a xml data file for drop-down values. This xml is different from data xml. I have two xmls (xml1 & xml2).

Xml1 : This contains drop down values or initial values for the controls like Country Drop-down, List of Items drop-down. When I import this xml, I see my forms are filled up with these initial values in drop-downs. User can select values from drop-down, user can override already populated some of the values and also user can fill out fields like text fields, numeric fields. This xml1 is required as I do not want to hard code drop-down values in drop-downs so i preferred to keep it as xml so that I can ask admin user to update this xml without adobe LC designer skill.

Xml2: This is an XML which has only form data but no initial data or drop-down data. This xml contains only field data that user has filed in form by selecting either drop-down items or text/numeric fields. This data is usually obtained after importing Xml1 so that user can select items from drop-down values.

Note that, when I import xml1, I have only drop-down values or some initial values. But when i import Xml2, I just have values that User has ever filled and exported but without drop-down items.

Xml1 will be updated once in a while as drop down items doesn't get added or deleted very frequently.

XMl2 is user data so it will be different for each users.

I am looking for a solution to embed Xml1 in adobe LC pdf so that user always see those dropdown values in forms whether or not Xml2 is imported in form.

Currently, I am merging first element of root nodes of both xml to achieve this solution.

Question: Is there anyway that I can upload XML1 in form so that It resides always there and when user data XML2 is imported, dropdowns and other fields get selected/filled with xml2 data.

Link for sample forms :  XML1, XML2 and Embedded XML

Regards

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Boost 50
MVP
_Bruce_Robertson
MVP

Likes

270 likes

Total Posts

1,782 posts

Correct Reply

372 solutions
Top badges earned
Boost 50
Boost 5
Boost 3
Boost 250
Boost 25
View profile

Avatar
Boost 50
MVP
_Bruce_Robertson
MVP

Likes

270 likes

Total Posts

1,782 posts

Correct Reply

372 solutions
Top badges earned
Boost 50
Boost 5
Boost 3
Boost 250
Boost 25
View profile
_Bruce_Robertson
MVP

20-09-2016

Hi Sunil,

The form submission xml is loaded under xfa.datasets.data, but you can also load other datasets under xfa.datasets and these won't affect the submission xml.

So a couple of ways of loading XML data into an alternative dataset is;

1 ... using code, for example this JavaScript in the preOpen event of the drop down list (uses E4X JavaScript extension to allow XML literals)

var caseXMLExport = <CaseXMLExport>
       <Races>
         <Race>
           <RaceId>10</RaceId>
           <RaceName>Asian</RaceName>
         </Race>
         <Race>
           <RaceId>11</RaceId>
           <RaceName>Bi-Racial</RaceName>
         </Race>
         <Race>
           <RaceId>2</RaceId>
           <RaceName>Black</RaceName>
         </Race>
       </Races>
     </CaseXMLExport>;
this.clearItems();
for each (var race in caseXMLExport.Races.Race) {
this.addItem(race.RaceName.toString(), race.RaceId.toString());
}


2 ... Editing the forms XML Source and adding XML directly under the xfa:datasets node,

<xfa:datasets xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/">
   <xfa:data xfa:dataNode="dataGroup"/>

   <dd:dataDescription dd:name="CaseXMLExport"/>

   <CaseXMLExport>

      <Races>

         <Race>

            <RaceId>10</RaceId>

            <RaceName>Asian</RaceName>

         </Race>

  ...

      </Races>

   </CaseXMLExport>

</xfa:datasets>

In this case you need to set the Dropdown list item binding to xfa.datasets.CaseXMLExport.Races.Race[*] and you can't use the Designer UI as it doesn't know about the CaseXMLExport dataset.

This is a sample showing both methods  https://sites.google.com/site/livecycledesignercookbooks/home/XML%20Binding.pdf?attredirects=0&d=1

Regards

Bruce

Answers (3)

Answers (3)

Avatar

Avatar
Coach
MVP
radzmar
MVP

Likes

395 likes

Total Posts

2,686 posts

Correct Reply

491 solutions
Top badges earned
Coach
Ignite 3
Ignite 1
Validate 1
Give Back 50
View profile

Avatar
Coach
MVP
radzmar
MVP

Likes

395 likes

Total Posts

2,686 posts

Correct Reply

491 solutions
Top badges earned
Coach
Ignite 3
Ignite 1
Validate 1
Give Back 50
View profile
radzmar
MVP

19-09-2016

Hi,

with JavaScript you can create as mansy data nodes as you want under the xfa.datasets-node.

I'm using this method very often to update sets of data in my forms without the need of editing them in Designer again.

Here's an Action for Acrobat XI or later that allows you to import your XMLs either under xfa.datasets.data or xfa.datasets.

Dateien freigegeben - Acrobat.com

Avatar

Avatar
Validate 25
Level 3
Mrsunilg-3z0lTX
Level 3

Likes

7 likes

Total Posts

295 posts

Correct Reply

9 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Boost 5
Boost 3
View profile

Avatar
Validate 25
Level 3
Mrsunilg-3z0lTX
Level 3

Likes

7 likes

Total Posts

295 posts

Correct Reply

9 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Boost 5
Boost 3
View profile
Mrsunilg-3z0lTX
Level 3

20-09-2016

Hi ACP,

Thanks for for sending me above code. That really helped me another. After learning what you did.

As show in below snapshot, I uploaded Xml1.xml file for dropdowns, read it and loaded at dataset node using code..

var inputStream = event.target.getDataObjectContents("Xml1.xml");

var str=util.stringFromStream(inputStream);

xfa.datasets.loadXML(str,false,false);

TextField1.rawValue=xfa.datasets.CaseXMLExport.saveXML("pretty");

Not i put xfa.form.remerge(); on click on Remerge and I see data is papulated in dropdown..

xmlExport.JPG

Please find the files at link : Attachments

Avatar

Avatar
Validate 25
Level 3
Mrsunilg-3z0lTX
Level 3

Likes

7 likes

Total Posts

295 posts

Correct Reply

9 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Boost 5
Boost 3
View profile

Avatar
Validate 25
Level 3
Mrsunilg-3z0lTX
Level 3

Likes

7 likes

Total Posts

295 posts

Correct Reply

9 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Boost 5
Boost 3
View profile
Mrsunilg-3z0lTX
Level 3

19-09-2016

Hi Radzmar,

Thanks for replying..

I know how to create nodes and manuplate xfa.datasets.data... nodes. But will i be able to upload/import both xmls (xml1 and xml2).

How do I embed XML1 in adobe LC form for forever.

In other words, I want to build a functionality to import both xmls in form. Currently, when I import xml2 after xml1, my xml1 data gets overridden by xml2.

plz. reply.. or let me know if my question is not clear.

regards

Sunil