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

Using Text fields for URLs when submitting Forms

SCE
Registered: Nov 21 2007
Posts: 2

Is it possible to use a text field as the URL for the "submit a form" option in a PDF form? I want to do a progressive routing of the form via e-mail and have each successive user route to the next based on data entered in a text field representing the e-mail address for each.

My Product Information:
Acrobat Pro 8, Windows
pddesigner
Registered: Jul 9 2006
Posts: 858
These tips are taken from - Developing Acrobat Applications Using Javascript.

URL : [url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]


Saving form data to and reading form data from an attachment

This example takes the response given in a text field of this document and appends it to an attached document. (Perhaps this document is circulating by email, and the user can add in their comments through a multiline text field.) This example uses four of the methods listed above.

var v = this.getField("myTextField").value;
// Get the contents of the file attachment with the name "MyNotes.txt"
var oFile = this.getDataObjectContents("MyNotes.txt");
// Convert the returned stream to a string
var cFile = util.stringFromStream(oFile, "utf-8");
// Append new data at the end of the string
cFile += "\r\n" + v;
// Convert back to a stream
oFile = util.streamFromString( cFile, "utf-8");
// Overwrite the old attachment
this.setDataObjectContents("MyNotes.txt", oFile);
// Read the contents of the file attachment to a multiline text field
var oFile = this.getDataObjectContents("MyNotes.txt");
var cFile = util.stringFromStream(oFile, "utf-8");
this.getField("myTextField").value = cFile;

Emailing completed forms

Recent versions of Acrobat have offered an entire workflow around email submittal of form data. To email a completed form in FDF format, invoke the mailForm method of the Doc object, which exports the data to FDF and sends it via email.

To make an interactive email session, pass true to the first parameter, which specifies whether a user interface should be used, as shown in the code below:

this.mailForm(true);
To send the exported FDF data automatically, pass false to the first parameter, and specify the cTO, cCc, cBcc, cSubject, and cMsg fields (all of which are optional), as shown in the code below:
this.mailForm(false, );
this.mailForm({
bUI: false,
cTo: "recipient [at] example [dot] com",
cSubject: "You are receiving mail",
cMsg: "A client filled in your online form and "
+ "submitted the attached data."
})

You must execute this command in a privileged context before the mail client will appear to the user.

My favorite quote - "Success is the ability to go from one failure to another with no loss of enthusiasm.