Expand my Community achievements bar.

Allowing user to create link to a network file

Avatar

Level 4

Is there a way to allow the user of a form to enter the path to a local network file (such as a Word document), so that when others click it, it will take them to the file?

In a thread in another forum, someone posted the following method of create a button containing the following code that converts text entered into a text field into a hyperlink:

if (xfa.host.name != "XFAPresentationAgent")

    {

    var oURI = xfa.resolveNode("form1.page1.header.TextField2").rawValue;

    var oLink = "<body xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:xfa=\"http://www.xfa.org/schema/xfa-data/1.0/\"><p style=\"letter-spacing:0in\"><a href=\"" + oURI+ "\" style=\"margin-top:0pt;margin-bottom:0pt;text-valign:bottom;font-fami ly:'Myriad Pro';font-size:8pt\">" + oURI + "</a></p></body>";

    xfa.resolveNode("form1.page1.header.TextField2").value.exData.loadXML (oLink, false, true);

    }

This works great for internet URLs; however, when you enter a local or network path (for example "Y:\Network\File.doc"), you get the following error message in your default browser:

Firefox doesn't know how to open this address, because the protocol (y) isn't associated with any program.

How would you alter this code so that it links to a local or network file, and doesn't try to open it in a web browser? Or, if this isn't possible, is there any other way to allow the user to create a clickable link to a file?

Thanks,

Jo

0 Replies