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
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Binding form to XML Schema

Avatar

Not applicable
I have an XML schema that defines a form I am building. In the schema, I have a repeating section called subject. Within subject, I have a field element called fullname. I have built my form, and added a subform with the field fullname. I bound the subform to the repeating node in the schema and the field to the element I require, and when I preview the form with a sample data file, I do get a variable number of subforms repeat on the form so life is great. Now the problem 😞

I have to repeat the variable number of fullnames two more times throughout the form. When I use the exact same binding, they don't populate the form. Can you bind subsequent fields or subforms in a form to something that is already bound to a field or subform in the form?

I then thought of trying to bind the subsequent occurrences of the data I need to the one(s) already populated in the form, but they don't trigger the subforms to lay down. The following is an example of the datafile:

23239875

John Doe


Jane Doe

...

Dave
0 Replies

Avatar

Not applicable
Unfortunately, because you need the data to be duplicated in 2 other locations in your form, I don't believe you can use "traditional" data binding methods to achieve that unless you used global fields with implicit bindings but this would most likely affect the structure of the objects on your form and may not be desirable if, say, you're using tables to present the data.



Another way to do this is not to use a data connection. Rather, do the data import manually and then populate all instances of the Fullname fields with script. This gets tricky, though, because you'll need to use a button which executes the "xfa.host.importData();" function and then you'll want to add code right after the call, in the button's Click event, to read the data and populate your fields. The problem with that is that there's a timing issue where you'll come back from the "xfa.host.importData();" call before the data is actually loaded into the Data Model and so your script won't work properly.



The solution therefore involves using some AcroForm tricks in order to delay the execution of the script which will read the data from the Data Model and populate the pertaining fields.



Rather than attempting to explain this is words, I've created a sample form which demonstrates how to do this. The form contains a field for the contractID data and then 3 tables which display copies of the Fullname data. After clicking on the "Load Data" button, the Validate event on an invisible text field is used as the trigger to run the "data import" script which populates the fields on the form.



I'll be happy to go into details if you have any specific questions.



Stefan

Adobe Systems

Avatar

Level 4
Hi Stefan,



thank You for the example. Unfortunatelly it doesn't work for me. Is Adobe Designer 7.1 required? I have version 7.0. 😞



--- Jaroslav

Avatar

Not applicable
Looking at the sample again, I used tables for the 3 "full name" sections which means that Designer 7.1 and Acrobat 7.0.5 are minimum requirements.



I've attached a second version of the sample. This time, I used "regular" subforms instead of tables so it
should work in Designer 7.0 with Acrobat 7.0.



Let me know how it goes...



Stefan

Adobe Systems

Avatar

Level 4
Hi,



my probem is probably, I have Acrobat 7.0.0.

In Javascript console I get error message:

NotAllowedError: Security settings prevent access to this property or method.

Field.comb:1:click undefined:Exec



When I commment first line in click event of Load Data button, I get File Open dialog "Select File Containing Form Data".



Thanks,

--- Jaroslav

Avatar

Not applicable
That's most likely the problem. Acrobat 7.0 isn't giving you access to the AcroForm field's comb property and that's causing a script error which means nothing beyond that line gets executed. This explains why once you comment-out the line, you finally get the "import data" dialog. The problem is the form won't work without the comb property.



Upgrading from Acrobat 7.0 to 7.0.7 is free... Can you do that?



Stefan

Adobe Systems

Avatar

Not applicable
Thanks Stefan, the form worked, and I was able to figure things out (the acroform trickery with the comb field). It should also be noted that this will not work with the free Reader unless you reader extend the form to allow "import and export of form data". When I first tried the form, nothing happened but after I extended it, the form behaved as it was supposed to.



Dave