Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to load XML into datasets on load in a dynamic PDF form (LiveCycle)?
    primarykey
    data
    text
    <p>I need to pre-fill a dynamic PDF's fields so my users can edit it and submit back. </p> <p>I am using Adobe ColdFusion CFPDFFORM tag that can load XML data into a PDF and make a new populated PDF. Unfortunately it also clears <strong>&lt;xfa:datasets&gt;</strong> tag, it completely empties it out! So all dropdownlists binded to datasets do not work. This is the code for binding one of them:</p> <pre><code>&lt;bindItems ref="xfa.datasets.LOVFile.LOV.PreferenceLanguageList.PreferenceLanguage[*]" labelRef="$" valueRef="lic"/&gt; </code></pre> <p>Since I have no control on how CFPDFFORM tag works, I came up with a workaround. Using LiveCycle Designer for codding, I store whatever data there is in <strong>&lt;xfa:datasets&gt;</strong> into a variable and load it to datasets at form::initialize.</p> <p>This seems to load datasets fine, just like how they were before cfpdform messed them up. After loadXML() call , I can read the datasets and get identical results as in the original PDF with its datasets tag full of XML data.</p> <pre><code>form1::initialize - (JavaScript, client) //xfa.host.messageBox("loading xml to datasets"); xfa.datasets.nodes.namedItem("LOVFile").loadXML(LOVFile_var.value,0,1); Page1.Header.debug.rawValue = xfa.datasets.LOVFile.LOV.PreferenceLanguageList.resolveNode("PreferenceLanguage[2]").value; </code></pre> <p>The problem is down down lists still don't work, they have no item to show. Somehow their binding call to datasets does not refresh?</p> <p>Is there anything else I should do after loadXML() ? LiveCycle reference for <em>bindItems</em> says "<em>The links between the list items and the referenced data are active. Any change to the data causes an immediate update to the list items.</em>"</p> <p>Any help or point to the right direction is greatly appreciated.</p> <p><strong>UPDATE:</strong></p> <p>using azathoth's answer I can add item to a dropdownlist using data from the newly loaded datasets (after loadXml() call). </p> <pre><code>var oEyeColors = xfa.datasets.LOVFile.LOV.resolveNode("EyeColorList"); var numberOfNodes = oEyeColors.nodes.length; var thisValue = ""; for (var i=0; i &lt; numberOfNodes ; i++){ thisValue = oEyeColors.nodes.item(i).value; if(thisValue == null){ thisValue = ""; } xfa.resolveNode("Page1.eyeColorDropDownList").addItem(thisValue.toString()); } </code></pre> <p>This works but is not the solution I am looking for. There must be a JavaScript way to set bindItems of a dropdown.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload