Expand my Community achievements bar.

Launching URL in new page from form hyperlink

Avatar

Level 3

Hi,

I have a Designer form in PDF format placed on my website. The PDF form has a text box that has a hyperlink in it. When the user clicks on the link, they are correctly sent to a new URL. However, if they close the new page, they disconnect from and close the form.

I had asked:

Is there any way to create the URL link in the text box so that it opens in a new window? That way, if the user closes the new window, the original PDF form is still open and visible.

Subsequently, I found this posting: http://forums.adobe.com/message/1335122

which suggests an answer. Using a script based on app.launchURL ("specific URL", true) seems to work.

Kind Regards,

saratogacoach

5 Replies

Avatar

Level 2

Hi,

You can use the script to open the url in a new browser:

app.launchURL("Your URL", true);

Regards,

Waqas

Avatar

Former Community Member

Stefan's posting is accurate. You can launch a new browser window from a PDF using the Acroform app object. However, you cannot attach script to a Text field to access the app object since Text object instances are static and not exposed to the object model.

Alternatively, you can use a TextField, hide the caption, remove the border, add a default value representing the URL, and underline the default value to make it appear as a URL. You can then attach the app.launchURL method to the click event of the TextField.

A sample is attached.

Steve

Avatar

Level 3

Hi Waqas, Steve.

Thanks for your replies. I basically had done what you had suggested: created a text input box to allow naming, removed unnecessary items, gave the text URL an underline and created the script following the "app......." which sets the hyperlink.

The only thing that my text input box leaves (or at least I can't figure out how to remove this) is that the cursor naturally changes to the standard flashing text input line cursor when over the box. Any way to change the cursor style by scripting?

Otherwise, works fine. Thanks for your suggestions.

Kind Regards,

saratogacoach

Avatar

Level 2

Hi,

You can use button instead of the textbox and put  the text that you want to show in the button  caption.

Regards,

Waqas

Avatar

Level 3

Hi Waqas,

Thanks. Creating this as a button works best!

Kind Regards,

saratogacoach