Skip to main content
Inspiring
January 24, 2022
Answered

Open a link entered in another form field

  • January 24, 2022
  • 1 reply
  • 1079 views

We have an Adobe form with a couple of field where the user can copy/paste a link to either a website or a document on a shared folder (sharePoint).

Most users only have adobe reader, so attching the links or attachments to the PDF form does not work. We ask them to copy/paste the link into a couple of fields.

Is it possible to have validation in the acual field (maybe RegEx) where the user enteres (or pastes) the link and format the string as a link, that the recipients of the for simply can click on the link to get to the document(s). 

 

Alternatively, I would like to have a button for the user to click and open the website or file rather than having to copy/paste the link out.

 

I have a simple code:

   // get the link in the field

      var Link1 = this.getField("SummaryDescription");

   // check field value

      app.alert(Link1.value, 2);

      app.launchURL(Link1.value);

 

The alert shows the correct link as entered in the form field.

The links (websites/sharepoint location) entered however don't open.

 

If I enter:    www.adobe.com   in the form field, the link in the web browser is: file:///C:/Users/xxxxx/Desktop/www.adobe.com

When I enter www.adobe.com/ or  https://www.adobe.com/ the link in the browser is:  https://www.adobe.com/%0D%20%0D%20  >  404 (adobe.com)

How can we prevent for the additionl parts at the start or end of the link to be added?

 

Any assistance would be greately apprechiated.

 

Many Thanks 🙂

 

 

This topic has been closed for replies.
Correct answer Oroos

It does work.


Thank you both for taking the time to check it out.

 

I did some more testing. Websites or SharePoint links (which are essentially weblinks) work.

The problem was if there is some additional whitespace, linebreak etc. in the field it will not work.

I have modified my code to the below and it seems to take care of that issue.

 

   // get the link in the field and remove whitespace
      var Link1 = this.getField("SupportingDos").value.replace(/\s/g,"");
      app.launchURL(Link1);

 

Thanks again.

1 reply

Bernd Alheit
Community Expert
January 24, 2022

Can you share the form?

OroosAuthor
Inspiring
January 24, 2022

Hi Bernd,

It is a pretty simple form. I have attached a reducted version of the form.

I did some more testing and links to websites seem to work sometimes, but not consistenly.

No sucess to open files if a link to a shared location is entered.

 

Thanks

try67
Community Expert
January 24, 2022

Works just fine for me. Where are you testing it, exactly?