Highlighted

Dynamically populating more than one field using xml data binding

Avatar

31-12-2008

Hi All,<br /><br />I have the following code that works fine to dynaically populate a<br />second drop-down list2 from a choice in drop-down list1 using xml data<br />biding.<br /><br />var tempString = "xfa.record." + this.boundItem(xfa.event.newText);<br />var oItems = xfa.resolveNode(tempString);<br />var nItemsLength = oItems.nodes.length;<br /><br />myinfo.page1.state.clearItems();<br />myinfo.page1.state.rawValue = null;<br /><br />for (var nItemCount = 0; nItemCount < nItemsLength; nItemCount++)<br />{<br />myinfo.page1.state.addItem(oItems.nodes.item(nItemCount).value);<br />}<br /><br />Here is my xml file<br /><br /><?xml version="1.0" encoding="UTF-8"?><br /><myinfo><br /><country/><br /><countries><br /><item uiname="United States" token="US"/><br /><item uiname="South Africa" token="SA"/><br /><item uiname="Australia" token="AU"/><br /></countries><br /><state/><br /><AU><br /><item>Australian Capital Territory</item><br /><item>New South Wales</item><br /><item>Northern Territory</item><br /><item>Queensland</item><br /><item>South Australia</item><br /><item>Tasmania</item><br /><item>Victoria</item><br /><item>Western Australia</item><br /></AU><br /><US><br /><item>California</item><br /><item>New York</item><br /><item>Texas</item><br /><item>Michigan</item><br /><item>North Carolina</item><br /><item>South Carolina</item><br /></US><br /><SA><br /><item>Eastern Cape</item><br /><item>Free State</item><br /><item>Gauteng</item><br /><item>KwaZulu-Natal</item><br /><item>Limpopo</item><br /><item>Mpumalanga</item><br /><item>Northern Cape</item><br /><item>North-West</item><br /><item>Western Cape</item><br /></SA><br /></myinfo><br /><br />I have two questions:<br /><br />1) I want to be able to structure my xml in a way that I can populate<br />a third drop-down list3 from a choice in list2. I need to know how to<br />to include the different capital cities of the states in my xml data<br />so that they can get populated in list3 from a selection in list2;<br /><br />2) And be able to script the third list3 to get dynamically populated<br />from a choice in list2.<br /><br />Thanks in advance for your help.

Replies

Highlighted

Avatar

05-01-2009

I would like to ask someone for help.

I have an XML file a result of the XSLT transformation. A schema was created based on this XML and this schema is bound to a form as a data source. When I preview my form using a Preview tab with transformed XML as a Data File in LiveCycle Designer 8.1, I can see only the first form data across 3 Text fields on the form. The rest of the forms are not getting displayed. What am I doing wrong?

Here is the part of the XML file Im trying to display on the form:

FORM 1
FORM 1 DESCRIPTION
$5000



FORM 2
FORM 2 DESCRIPTION
$7000



FORM 3
FORM 3 DESCRIPTION
$4000



Part of the schema that was created based on the XML file from above:











Thank you.
Highlighted

Avatar

Avatar

pguerett

Total Posts

(val/1000)?string[".0"]}K

Likes

611

Correct Answer

692

Avatar

pguerett

Total Posts

(val/1000)?string[".0"]}K

Likes

611

Correct Answer

692
pguerett

05-01-2009

On the subform that holds this information, check the binding tab and make sure that "Repeat subform for Each Data Item" is checked.
Highlighted

Avatar

05-01-2009

Thank you, Paul. The only problem is that when I add a subform, the option you suggested to use is disable. Do I need to do something else to enable it?



Thanks again.
Highlighted

Avatar

Avatar

pguerett

Total Posts

(val/1000)?string[".0"]}K

Likes

611

Correct Answer

692

Avatar

pguerett

Total Posts

(val/1000)?string[".0"]}K

Likes

611

Correct Answer

692
pguerett

05-01-2009

That usually means that the root level subform for these is not flowed....or that you need to go to a higher level to allow it before you can change it on a lower subform.
Highlighted

Avatar

05-01-2009

Paul,



I tried and still didn't work. I used the "Hierarchy" tab to select the Parent Subform "Repeat Subform for each option". It was enabled. I selected the check box, which automaticaly selected check box "Min Count" and set default value to 1. Do I have to make any changes there to make my subform to become enabled?



Thanks again.
Highlighted

Avatar

Avatar

pguerett

Total Posts

(val/1000)?string[".0"]}K

Likes

611

Correct Answer

692

Avatar

pguerett

Total Posts

(val/1000)?string[".0"]}K

Likes

611

Correct Answer

692
pguerett

06-01-2009

Can you send me the form and a sample data file and I will play with it here. Send it to livecycle8@gmail.com
Highlighted

Avatar

07-01-2009

Good morning Paul,



I have the attached PDF file and xml document that are working fine. My only problem now is to be able to adjust the XML with the information for the respective cities of each state so that when a country is selected in list1 (country) the corresponding states are selected in list2 (state) and once a state is selected in list2 automatically list3 (cities) get populated with the corresponding cities.



So my problem is that I don't know how to expand the file by add the cities with the correct specifications so that they become child node of the states.



Thank you in advance for your help.



Loralon



PS: my two files are in this discussion group: http://groups.google.com/group/livecycle/browse_thread/thread/ebac85e453a0db1c/34684c502d92d7fc?hl=e...