Button with generated Link

Community Beginner ,
Mar 04, 2021 Mar 04, 2021

Copy link to clipboard

Copied

Hi,
I need some little help with a button and javascript. I have a PDF that creates a url from two fields and I want to set this url behind a button. So that the url is not showen in a field just behind the button. The url is also not fixed it depends on what the user select.

 

Any help welcome. I have no idea how to do this.

 

Thanks,

Daniela

TOPICS
Create PDFs, How to, JavaScript

Views

63

Likes

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

correct answers 2 Correct Answers

Adobe Community Professional , Mar 04, 2021 Mar 04, 2021
You can do it in the button's Mouse Up script. For example, if the fields composing the URL are URL1 and URL2 you can use something like this: var fullURL = "http://www." + this.getField("URL1").valueAsString + ".com/" + this.getField("URL2").valueAsString + ".html"; app.launchURL(fullURL);

Likes

Translate

Translate
Community Beginner , Mar 04, 2021 Mar 04, 2021
For now I have created a field where the url is displayed. To address this fild I just have to change "URL1" with the name of the field? Right?

Likes

Translate

Translate
Adobe Community Professional ,
Mar 04, 2021 Mar 04, 2021

Copy link to clipboard

Copied

Not sure what you mean by "I want to set this url behind a button"... Do you mean you want to add the URL as plain-text on the page? If so, you can use a read-only text field, but why not just use the button itself to both show the URL and launch it when clicked?

Likes

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 Beginner ,
Mar 04, 2021 Mar 04, 2021

Copy link to clipboard

Copied

I dont want to show the url. I just want to pack it into a button. But the url is not always the same. Its generated of to fields. So I dont know how to get this into a button.

Likes

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
Adobe Community Professional ,
Mar 04, 2021 Mar 04, 2021

Copy link to clipboard

Copied

You can do it in the button's Mouse Up script. For example, if the fields composing the URL are URL1 and URL2 you can use something like this:

 

var fullURL = "http://www." + this.getField("URL1").valueAsString + ".com/" + this.getField("URL2").valueAsString + ".html";

app.launchURL(fullURL);

Likes

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 Beginner ,
Mar 04, 2021 Mar 04, 2021

Copy link to clipboard

Copied

For now I have created a field where the url is displayed. To address this fild I just have to change "URL1" with the name of the field? Right?

Likes

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 Beginner ,
Mar 04, 2021 Mar 04, 2021

Copy link to clipboard

Copied

Bildschirmfoto 2021-03-04 um 12.46.43.png

 

Hope the images help to explain it. I have to fileds creating a url. The url is now at text field. But I want this url in the green button.

Likes

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
Adobe Community Professional ,
Mar 04, 2021 Mar 04, 2021

Copy link to clipboard

Copied

Want you create a URL and use this URL in a button?

Likes

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 Beginner ,
Mar 04, 2021 Mar 04, 2021

Copy link to clipboard

Copied

yes, I dont want to show the url. But the url is generated of to fields and not always the same url.

Likes

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
Adobe Community Professional ,
Mar 04, 2021 Mar 04, 2021

Copy link to clipboard

Copied

You can use the Javascript method lunchURL:

Bild1.jpg

Likes

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
Adobe Community Professional ,
Mar 04, 2021 Mar 04, 2021

Copy link to clipboard

Copied

LATEST

Use the Javascript action of the button.

Likes

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