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
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);
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?
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?
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.
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);
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?
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Want you create a URL and use this URL in a button?
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.
Copy link to clipboard
Copied
You can use the Javascript method lunchURL:
Copy link to clipboard
Copied
Use the Javascript action of the button.