Skip to main content
New Participant
July 9, 2020
Answered

Trying to have a Link or button URL change, based on value in a text field

  • July 9, 2020
  • 1 reply
  • 963 views

Hello, 

 

I am currently trying to create a PDF of a schedule, where a user can select their desired program from a dropdown and the button will automatically have the corresponding link. 

 

I followed this tutorial to get the dropdown selection to effect a text field (successfully), but have no idea how to have the dropdown edit the link or button element, OR have the text field (based on the dropdown) effect the link/button. (I say link/button because I can use whichever works!)

 

Any assistance or links would be amazing, I've tried googling but no one else that I could find seems to want to do this. 

 

Thanks,

Sarah

This topic has been closed for replies.
Correct answer try67

Ah OK, got it. Let's say the text field is called "Text1". You can then use this code as the MouseUp event of the button field:

 

var t1 = this.getField("Text1").valueAsString;

if (t1=="") app.alert("The field is empty.");

else app.launchURL(t1);

1 reply

try67
Community Expert
July 9, 2020

Please be a bit more specific. Do you want to use the value of the text field in the URL? So if the text field says "Text1" the URL that the button will launch will be "http://www.google.com/q/Text1", for example?

benoitsmAuthor
New Participant
July 10, 2020
Sorry about that!
Basically, I want the text value appearing in the text field currently (its a URL) to be passed in. So, the value appearing as text in the text field is”www.google.com”, and I want that URL to be hyperlinked to a button.
try67
try67Correct answer
Community Expert
July 10, 2020

Ah OK, got it. Let's say the text field is called "Text1". You can then use this code as the MouseUp event of the button field:

 

var t1 = this.getField("Text1").valueAsString;

if (t1=="") app.alert("The field is empty.");

else app.launchURL(t1);