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

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

Community Beginner ,
Oct 06, 2020 Oct 06, 2020

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.

TOPICS
How to , PDF forms
4.2K
Translate
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
1 ACCEPTED SOLUTION
Community Expert ,
Oct 06, 2020 Oct 06, 2020

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.

View solution in original post

Translate
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 ,
Oct 06, 2020 Oct 06, 2020

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?

Translate
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 ,
Oct 06, 2020 Oct 06, 2020

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.

Translate
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 ,
Oct 06, 2020 Oct 06, 2020

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?

Translate
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 ,
Oct 06, 2020 Oct 06, 2020

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?

Translate
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 ,
Oct 06, 2020 Oct 06, 2020

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

Translate
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 ,
Oct 06, 2020 Oct 06, 2020

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).

Translate
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 ,
Oct 06, 2020 Oct 06, 2020

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

Translate
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 ,
Oct 06, 2020 Oct 06, 2020

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.pngexpand image

 

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?

Translate
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 ,
Oct 06, 2020 Oct 06, 2020

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.

Translate
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 ,
Oct 06, 2020 Oct 06, 2020

Also, what action did you use?

Translate
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 ,
Oct 06, 2020 Oct 06, 2020

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

I used the Mouse Up event as per your post - is that right?

Translate
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 ,
Oct 06, 2020 Oct 06, 2020

Yes, that's correct.

Translate
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 ,
Oct 06, 2020 Oct 06, 2020

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!!

Translate
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 ,
Oct 09, 2020 Oct 09, 2020

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?

Translate
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 ,
Oct 09, 2020 Oct 09, 2020

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

Translate
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 ,
Oct 09, 2020 Oct 09, 2020

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.

Translate
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 ,
Oct 09, 2020 Oct 09, 2020

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.

Translate
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 ,
Oct 09, 2020 Oct 09, 2020

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.

Translate
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 ,
Oct 09, 2020 Oct 09, 2020

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

Translate
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 ,
Oct 12, 2020 Oct 12, 2020

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

Is this what you are after?

Translate
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 ,
Oct 12, 2020 Oct 12, 2020

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).

 
Translate
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 ,
Oct 14, 2020 Oct 14, 2020

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.

Translate
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 ,
Oct 14, 2020 Oct 14, 2020

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.

Translate
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 ,
Oct 14, 2020 Oct 14, 2020

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. 

Translate
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