• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
4

Insert text containing hyperlink when a certain check box is selected

New Here ,
Apr 02, 2024 Apr 02, 2024

Copy link to clipboard

Copied

I'm creating a form where someone indicates which professional development resources they are going to use to build skills in different areas by selecting the fillable checkboxes next to the resources. When they select the checkbox, the relevant resource is pulled into a text field in their Development Action Plan at the end of the form using the code below (found in a previous post) as 'Calculation' script of the text field:

 

if(this.getField("Checkbox1").valueAsString != "Off")
event.value = "Text for checkbox 1 goes here";

else if(this.getField("Checkbox2").valueAsString != "Off")
event.value = "Text for checkbox 2 goes here";

else
event.value = "";

I've changed the checkbox names in script to the names of my checkboxes and changed the event.value text to the resources I want to show - and all of this is working.

 

Here's where I need help: Some of the resources I want to pull into the text field when a box is checked are text that include hyperlinks, which don't pull through using the code above. Is there a way to modify the code I'm using so that the text being pulled into the text field will include a hyperlink? Or, if not, a clickable URL?

TOPICS
How to , JavaScript , PDF forms

Views

318

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 03, 2024 Apr 03, 2024

Copy link to clipboard

Copied

Can you confirm where are the resources you mention? Locally stored, online, same or different file?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 03, 2024 Apr 03, 2024

Copy link to clipboard

Copied

The resources I want to link are online, accessible via the URLs I have hyperlinked in the text I'm pulling through using the script above.

(I'm including some screenshots from the form I'm creating -- the first one with the checkboxes shows the resources, including the hyperlinks to additional online resources, and the second is the text field the resources get pulled into when a box is checked)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 03, 2024 Apr 03, 2024

Copy link to clipboard

Copied

LATEST

There are a couple of ways to create link actions in a PDF. Unfortunately it is not easy to creat a link over top of a text field. 

Your best bet might be to create a separate button for each of the URLs.  The buttons should be invisble, no border, background, or caption. Initially the buttons would also be invisible. Then when a checkbox requiring an URL is checked, the button is positioned and made visible.   The text field under the button should be readonly so the clicks go to the button.

 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines