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

PDF PrepareForm text box: How to replace windows UNC path to Absolute path name in URI notation

Community Beginner ,
Sep 14, 2021 Sep 14, 2021

Copy link to clipboard

Copied

I have a text field that my user will enter a windows UNC path \\server\share. Is it possible to have a java script on that text fied that will change that path to be an Absolute path name in URI notation & make it a clickable link? 

The manual process is to paste the windows UNC path, then highlight it, right click to create a hyperlink, then paste that same windows UNC path and chage the backslashes "\" to be forwardslashes "/". 

TOPICS
How to , JavaScript , PDF forms

Views

822

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 Expert ,
Sep 14, 2021 Sep 14, 2021

Copy link to clipboard

Copied

Sure, it's a simple reg-exp command (to be used as a custom Validation or Calculation script):

event.value = event.value.replace(/\\+/g, "/");

 

You can't define it as a hyperlink automatically, though.

Votes

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 ,
Sep 15, 2021 Sep 15, 2021

Copy link to clipboard

Copied

Try67,

That script work for the most part but when it runs it replaced the "\\" with the "//" but also the share of "\" was replace with 2 "//" vs one.

Votes

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 Expert ,
Sep 15, 2021 Sep 15, 2021

Copy link to clipboard

Copied

Sorry, I don't follow. Can you provide an example?

Votes

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 ,
Sep 16, 2021 Sep 16, 2021

Copy link to clipboard

Copied

try67 -  When the script ran it change the share name to double slashes when it needed to be one slash. EX \\server\share ended up being //server//share. I would like it to be //server/share

 

 

Thank you!

Votes

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 Expert ,
Sep 16, 2021 Sep 16, 2021

Copy link to clipboard

Copied

It doesn't do that for me... Can you share your file?

Votes

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 ,
Sep 16, 2021 Sep 16, 2021

Copy link to clipboard

Copied

try67- I told you incorrectly. When the script ran (either as a validation or calculated) it changes the share name to SINGLE slash when it needed to be two slashes. EX \\server\share ended up being /server/share. I would like it to be //server/share

 

 

Votes

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 Expert ,
Sep 16, 2021 Sep 16, 2021

Copy link to clipboard

Copied

Remove the "+" sign from the RegExp, then.

Votes

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 ,
Sep 16, 2021 Sep 16, 2021

Copy link to clipboard

Copied

Thank you try67! that worked.

 

Do you know of anyway in the adobe javascript tools guilde to make that an hyperlink?

Votes

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 Expert ,
Sep 16, 2021 Sep 16, 2021

Copy link to clipboard

Copied

LATEST

No, sorry.

Votes

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