Highlighted

Can a user entered URL in form text field be a hyperlink?

Community Beginner ,
Oct 06, 2020

Copy link to clipboard

Copied

Firstly - sorry if this has already been asked and answered, but I can't find a successful solution anywhere.

 

I have created an interactive form in Acrobat Pro DC, with one of the editable fields being where a user adds a URL link. I want this link to be "clickable" and to go to that URL - but I at the moment the text doesn't act as a link.

 

The initial blank form will distributed be used by different users, and therefore the URL will be different in each case.

 

I found a potential fix, that made use of a button and javascript, but I couldn't get it to work - probably as my knowledge in this area is VERY limited and I was probably doing something wrong.

 

Can anyone help with a step by step solution for the less well initiated, please? Thanks.

Most Valuable Participant
Correct answer by try67 | Most Valuable Participant

Sorry, there's an error in the code above. It needs to be:

app.launchURL(this.getField("Name of text field").valueAsString);

Of course, you'll need to adjust the code to have the actual field name in double-quotes.

If it's still not working please share the file for further help with this.

TOPICS
How to, PDF forms

Views

86

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

Can a user entered URL in form text field be a hyperlink?

Community Beginner ,
Oct 06, 2020

Copy link to clipboard

Copied

Firstly - sorry if this has already been asked and answered, but I can't find a successful solution anywhere.

 

I have created an interactive form in Acrobat Pro DC, with one of the editable fields being where a user adds a URL link. I want this link to be "clickable" and to go to that URL - but I at the moment the text doesn't act as a link.

 

The initial blank form will distributed be used by different users, and therefore the URL will be different in each case.

 

I found a potential fix, that made use of a button and javascript, but I couldn't get it to work - probably as my knowledge in this area is VERY limited and I was probably doing something wrong.

 

Can anyone help with a step by step solution for the less well initiated, please? Thanks.

Most Valuable Participant
Correct answer by try67 | Most Valuable Participant

Sorry, there's an error in the code above. It needs to be:

app.launchURL(this.getField("Name of text field").valueAsString);

Of course, you'll need to adjust the code to have the actual field name in double-quotes.

If it's still not working please share the file for further help with this.

TOPICS
How to, PDF forms

Views

87

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
Oct 06, 2020 0
Most Valuable Participant ,
Oct 06, 2020

Copy link to clipboard

Copied

The best solution is to do it using a separate button field, yes, or to set the text field as having Rich Text Formatting, which will allow the user to manually add hyperlinks to it. What was the issue when you tried to do the former?

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
Reply
Loading...
Oct 06, 2020 0
Community Beginner ,
Oct 06, 2020

Copy link to clipboard

Copied

Thanks for the response - I added a separate button near the field, but there was no action when I clicked it. It may have been that the javascript I had was not correct or that I haven't implemented it correctly. As I said, I am very underskilled in this area, so that is quite possible! Ideally, I would like the process to be automatic - with no further input from the user other than to add the URL in the field.

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
Reply
Loading...
Oct 06, 2020 0
Most Valuable Participant ,
Oct 06, 2020

Copy link to clipboard

Copied

To do it like you describe is probelmatic. If they click onto the field and it opens a URL, how will they be able to click onto it in order to edit its value?

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
Reply
Loading...
Oct 06, 2020 0
Community Beginner ,
Oct 06, 2020

Copy link to clipboard

Copied

They don't need to edit the value - the form is a one time only use.

 

The form I have designed is actually a quotation form, that the user (my client) fills in with pricing and other information. One of these bits of information is a URL to a specific area on their website containing a product schedule that THEIR client can then click on to.

 

The form will be password protected so that my client will lock the form once they have filled everything in before they send it to their client - does that all make sense?

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
Reply
Loading...
Oct 06, 2020 0
Most Valuable Participant ,
Oct 06, 2020

Copy link to clipboard

Copied

Lock it how, exactly? If the field is locked then clicking it won't do anything, anyway...

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
Reply
Loading...
Oct 06, 2020 0
Community Beginner ,
Oct 06, 2020

Copy link to clipboard

Copied

My client will have a password that will protect the file once they have added the content they need. It is then password-protected so their client can't edit the content.

 

I have password-protected the file as it stands and the other elements of the file that are interactive (other hyperlinks etc) are still active even when it is protected, so I was hoping that the URL link that is entered would behave in the same way, allowing the end-user to gain access to the website by simply clicking on the link (or button if that is the case).

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
Reply
Loading...
Oct 06, 2020 0
Most Valuable Participant ,
Oct 06, 2020

Copy link to clipboard

Copied

From the button's Mouse Up event you can use this code

app.launchURL(this.getField("Name of text field").valueAsString);

You can use the same from the field itself.

 

Edit: code fixed

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
Reply
Loading...
Oct 06, 2020 0
Community Beginner ,
Oct 06, 2020

Copy link to clipboard

Copied

Thanks for that - I have tried it and it is getting closer to what I want.

 

I have added it as an action to the field itself, then password protected it and added a test URL (BBC sport) - however when I click on the field I get the following message. When I click "allow", there is no further action

 

Screenshot 2020-10-06 at 15.44.34.png

 

Don't worry about the password indicated here - this is a unique password my client would add when they add the unique URL and isn't active at this point.

 

Can you advise, please?

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
Reply
Loading...
Oct 06, 2020 0
Most Valuable Participant ,
Oct 06, 2020

Copy link to clipboard

Copied

Sorry, there's an error in the code above. It needs to be:

app.launchURL(this.getField("Name of text field").valueAsString);

Of course, you'll need to adjust the code to have the actual field name in double-quotes.

If it's still not working please share the file for further help with this.

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
Reply
Loading...
Oct 06, 2020 1
Most Valuable Participant ,
Oct 06, 2020

Copy link to clipboard

Copied

Also, what action did you use?

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
Reply
Loading...
Oct 06, 2020 0
Community Beginner ,
Oct 06, 2020

Copy link to clipboard

Copied

Thanks again for that - I'll give it a go.

I used the Mouse Up event as per your post - is that 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
Reply
Loading...
Oct 06, 2020 0
Most Valuable Participant ,
Oct 06, 2020

Copy link to clipboard

Copied

Yes, that's correct.

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
Reply
Loading...
Oct 06, 2020 0
Community Beginner ,
Oct 06, 2020

Copy link to clipboard

Copied

It works like a dream...

 

...apart from when I password protect the file. Then the link doesn't work.

 

I tried it using the button option - again it works fine until I password protect it.

 

So close!!

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
Reply
Loading...
Oct 06, 2020 0
Community Beginner ,
Oct 09, 2020

Copy link to clipboard

Copied

Hi try67 - thanks ever so much for your help with the script for including the URL as a link. Tha part worked a treat, my only problem now is that when I password protect the file it disables the link functionality. Do you have any ideas on how to get around this?

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
Reply
Loading...
Oct 09, 2020 0
Most Valuable Participant ,
Oct 09, 2020

Copy link to clipboard

Copied

You have to select a security policy that allows filling in of form fields for it to work.

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
Reply
Loading...
Oct 09, 2020 0
Community Beginner ,
Oct 09, 2020

Copy link to clipboard

Copied

I have - but this would be after my client has filled in the content, and entered the URL.

 

They then lock the file at this stage, so that their client can't amend the content of the fields. This is where we need the URL to be clickable (as other hyperlinks on the document are) but when it is password protected, it isn't clickable.

 

The fields are locked, which is correct, and the other hyperlinks still work, but the URL that is entered before the file is password protected doesn't.

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
Reply
Loading...
Oct 09, 2020 0
Most Valuable Participant ,
Oct 09, 2020

Copy link to clipboard

Copied

You can't have it both ways. If the fields are locked then the user can't interact with the text field.

The only type of field that would work in that situation is a button, so you need to use that, instead.

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
Reply
Loading...
Oct 09, 2020 0
Community Beginner ,
Oct 09, 2020

Copy link to clipboard

Copied

Sorry - I didn't think I was trying to have it both ways.

 

The only interaction I wanted was to click on a link - I wasn't looking for it to be edited after it was locked.

 

As I said I am new to the complexities of Acrobat and scripts etc and thought that as other hyperlinks on the form remain live, that this new URL being a link would also be live.

 

I have tried the button method too - and that is also locked when password protection is added - unless I am doing something wrong. I followed the instructions you sent before and the button worked great - before the file was locked.

 

Sorry to be a pain - I am on a learning curve here, and if it can't be done, then I will just have to tell the client that is the case.

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
Reply
Loading...
Oct 09, 2020 0
Most Valuable Participant ,
Oct 09, 2020

Copy link to clipboard

Copied

What exact options did you select when you applied the security policy?

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
Reply
Loading...
Oct 09, 2020 0
Community Beginner ,
Oct 12, 2020

Copy link to clipboard

Copied

Hi - here are the screen grabs of the security settings that I used...Screenshot 2020-10-12 at 12.59.07.pngScreenshot 2020-10-12 at 12.57.46.png

Is this what you are after?

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
Reply
Loading...
Oct 12, 2020 0
New Here ,
Oct 12, 2020

Copy link to clipboard

Copied

I have password-protected the file as it stands and the other elements of the file that are interactive (other hyperlinks etc) are still active even when it is protected, so I was hoping that the URL link that is entered would behave in the same way, allowing the end-user to gain access to the website by simply clicking on the link (or button if that is the case).

 

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
Reply
Loading...
Oct 12, 2020 0
Community Beginner ,
Oct 14, 2020

Copy link to clipboard

Copied

Hi try67

Did you see the screen grabs I sent of the security settings - are they ok?

Is this something that isn't possible to do and do I need to give up on it?

Thanks again for your time spent on this - you showed me how to get passed the initial issue I had, which will be helpful in the future. Dave.

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
Reply
Loading...
Oct 14, 2020 0
Most Valuable Participant ,
Oct 14, 2020

Copy link to clipboard

Copied

I did, and as I said multipe times before, it will work if you use a button field, not if you keep on using a text field to launch the 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
Reply
Loading...
Oct 14, 2020 0
Community Beginner ,
Oct 14, 2020

Copy link to clipboard

Copied

I am sorry - I didn't mean to make you feel as though you had to repeat yourself or that I was pushing on this, but I did already refer back to that point.

 

I have also tried this as a button rather than just a text field - and with the security setting I sent, it didn't work.

 

To clarify - both the text field and button field options worked perfectly until I password protected the file so as not to allow any further editing of the file, then neither option worked. 

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
Reply
Loading...
Oct 14, 2020 0
Most Valuable Participant ,
Oct 14, 2020

Copy link to clipboard

Copied

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
Reply
Loading...
Oct 14, 2020 1
Community Beginner ,
Oct 14, 2020

Copy link to clipboard

Copied

Seeing your test I realised I might be using the button in the wrong way. As I said I am really green when it comes to the finer points of Acrobat. I have created a new button it works like a dream!!!

 

Thank you so much for your persistence with this (and with me) - it really is appreciated. I owe you a beer!

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
Reply
Loading...
Oct 14, 2020 0
Most Valuable Participant ,
Oct 14, 2020

Copy link to clipboard

Copied

You're very welcome, and I accept beer funds here. Cheers! 😉

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
Reply
Loading...
Oct 14, 2020 1