Skip to main content
chrisr-frb
Participant
May 9, 2019 10:21 PM UTC
Question

Using user entered form field data to code a hyperlink

Hello,

I am creating a flyer with form fields on it, that will ultimately be flattened to read only by submit button and saved as a PDF.

One of the form fields is for the end user to enter a URL. I named it referralLink

Is it possible to pull the data from referralLink and program it to a hyperlink so that after the form and PDF is flattened and exported, the hyperlink will navigate to said URL.

This topic is closed to new replies. Start a new post to keep the conversation going.

3 replies

chrisr-frb
Participant
May 10, 2019 4:30 PM UTC

I figured this out:

I am simply creating a PDF flyer template with customizable contact and sales rep information. The rep has a unique URL that they will type in to the form, along with their name, title and contact. There is a graphic of a button (created in the authoring too) that I placed a transparent form submit button with the following code:

var linkers = this.getField("referralLink").valueAsString; //referralLink being the field with the URL

app.launchURL (linkers, true); //opens browser window and navigates to URL on click

Elsewhere on the PDF is a SUBMIT button that flattens the form and opens a save as prompt so that the rep can save and reuse the PDF.

I've figured this out. Thanks for your responses.

Translate
try67
Community Expert
Community Expert
May 10, 2019 5:58 AM UTC

Exported to what format, exactly? You can display the URL as plain-text and it might get picked up, depending on the format.
Anything else is not likely to work.

Translate
Thom Parker
Community Expert
Community Expert
May 9, 2019 11:43 PM UTC

It depends. Data can be acquired from an URL with a trusted function in Acrobat Professional. This really only works from a folder level script. Can you install an Acrobat script onto all the systems where this form will be used?

The app.launchURL() function opens a web page.

Translate
Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often