These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Importing an FDF and matching field names

David Dunn
Registered: Oct 28 2010
Posts: 116
Answered

I would like to set up an importAnFDF() action where the fdf source file has different field names than the receiving file. I want to match the field names of the source file to field names in the receiving form. I tried the following setup but get a null return on field names not present in the target file:
 
this.importAnFDF()
var afn = this.getField("txt.Atty.FirstName")//field name in source fdf
var bafn = this.getField("txtTPB.Atty.FirstName")//field name in receiving form
bafn.value = afn.value
 
Is it possible to achieve my objective without the field names from the fdf source being present in the receiving form?
  

David D

My Product Information:
Acrobat Pro 9.4, Windows
maxwyss
Online
Registered: Jul 25 2006
Posts: 256
Accepted Answer
When importing an FDF, the following happens:

a) when the field exists in the form and in the FDF, the value gets imported.

b) when the field exists in the form, but not in the FDF, nothing happens.

c) when the field does not exist in the form, but exists in the FDF, it gets ignored.

In fact, anything else would not make sense, IMHO.

So, what you want to accomplish is not possible.

You would either convert the FDF to match your fields before you import it (you can use XML handling functions, and stitch together an appropriate XSLT). Or you add matching fields into your form, or you rename your form's fields.

If this scenario occurs frequently with different forms, you might need some management system; I have developed some concepts in that field; feel free to contact me in private.

HTH.

David Dunn
Registered: Oct 28 2010
Posts: 116
Thank you. I was hoping for a method that would either pass the source fields' values to the target fields' values or rename the field name property in each source field to match the each target field. I am not familiar with XML handling functions or XSLT. I have an easy alternative by copying one entity to another in the form file after importing the data, but I certainly appreciate your input so that I am not chasing a dead end.

David D

maxwyss
Online
Registered: Jul 25 2006
Posts: 256
After thinking over it a bit, one possibiliiy which might work, would be importing the FDF as a Data Object, and then start to interpret it from there. I can't guarantee that it does work, and it might require some fiddling around, but that would be a way to get the data from the FDF into the form without having the correct field names.

Otherwise, without matching field names, you won't be able to retrieve data from the FDF when you import it.

HTH.