Hi guys,
this one should be straight forward, but I cant seem to find a straight forward answer. In a nutshell:
XML file contains ID, Name, Location (so far 3 records in sample xml file)
Form contains a Dynamic Drop down list to allow selection of ID and text fields to display the associated name and location of that ID. The binding of the Drop down works fine, however I need the other fields to update to the associated name and location when different ID's are selected. I assume I'll need some sort of exit event on the drop down list to update the other fields with the Name and location of the ID selected, but I dont know enough to have a stab at it.
please, please, please help, Im starting to pull my hair out.
James.
Solved! Go to Solution.
Views
Replies
Total Likes
Sorry, looking at it again I could have given a better description of what is happening.
Have a look at this sample https://acrobat.com/#d=NO5o6NhPTQgSYu3SVoN7rQ and the data to go with it https://acrobat.com/#d=jN*pRT4uGg05VU*sGWvjcA
The thing I should have said and I guess is your problem is the the Data property I used in $data.Data.resolveNode(....) must match the parent element of your event element so if xml looks like
<events>
<event>
<eventid>1</eventid>
<eventname>name 1</eventname>
<eventlocation>location1</eventlocation>
</event>
Then it should be $data.events.resolveNode(....)
Maybe I should have used "var itemGroup = $data.resolveNode("events.event.(eventId.value === '"+xfa.event.change+"')");" in this case but I try and make the resolveNode start from as low down as possible.
Regards
Bruce
Views
Replies
Total Likes
Hi James,
This would depend on the structure of your XML but assuming you have something like;
<Data>
<Item>
<Id>1</Id>
<Name>Name1</Name>
<Location>Location1</Location>
</Item>
<Item>
<Id>2</Id>
<Name>Name2</Name>
<Location>Location2</Location>
</Item>
<Item>
<Id>3</Id>
<Name>Name3</Name>
<Location>Location3</Location>
</Item>
</Data>
Then in the change event of your dropdown (your could use the exit event but then value might not have changed so would be performing unnecessary processing) add the following code.
var itemGroup = $data.Data.resolveNode("Item.(Id.value === '"+xfa.event.change+"')");
Name.rawValue = itemGroup.Name.value;
Location.rawValue = itemGroup.Location.value;
The xfa.event.change will be the value selected, the resolveNode will return the Item with the matching Id, and then it is just a matter of assigning it to your form fields.
Hope this gets you started.
Regards
Bruce
Views
Replies
Total Likes
Hi Bruce,
many thanks, I tried this but no luck.
XML structure as follows:
<event>
<eventid>1</eventid>
<eventname>name 1</eventname>
<eventlocation>location1</eventlocation>
</event>
-------------------------
this is what I assigned to the change event of the drop down list.
var itemGroup = $data.Data.resolveNode("event.(eventId.value === '"+xfa.event.change+"')");
event_Name.rawValue = itemGroup.eventName.value;
event_Location.rawValue = itemGroup.eventLocation.value;
event_name and event_location are the names of the text fields in the form, they reside in the same subform
any hints
Views
Replies
Total Likes
Sorry, looking at it again I could have given a better description of what is happening.
Have a look at this sample https://acrobat.com/#d=NO5o6NhPTQgSYu3SVoN7rQ and the data to go with it https://acrobat.com/#d=jN*pRT4uGg05VU*sGWvjcA
The thing I should have said and I guess is your problem is the the Data property I used in $data.Data.resolveNode(....) must match the parent element of your event element so if xml looks like
<events>
<event>
<eventid>1</eventid>
<eventname>name 1</eventname>
<eventlocation>location1</eventlocation>
</event>
Then it should be $data.events.resolveNode(....)
Maybe I should have used "var itemGroup = $data.resolveNode("events.event.(eventId.value === '"+xfa.event.change+"')");" in this case but I try and make the resolveNode start from as low down as possible.
Regards
Bruce
Views
Replies
Total Likes
Many thanks Bruce, works a treat.
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies