Solved

Control to open a file

  • 27 August 2018
  • 5 replies
  • 104 views

Badge +8

I would like to be able to open a file from network location

i know you can navigate to url for a website

is it possible to navigate to file uri

file://network/file.txt

 

this doesn't work in the navigate to url rule

is there another way?

icon

Best answer by ThinusC 27 August 2018, 17:26

View original

5 replies

Badge +10

Hi braddo


 


You should be able to use a normal Data Label. The catch is to enable Literal on the control and then add the following text: <a href="file:///serversharefilename.txt">Link to file</a>


 


The Data Label will display a clickable link to the file on the network share.


 


Cheers.


T

Badge +8

Hi T

I have that in other forms, i was just seeing if it was possible to use a button and rule

 

Userlevel 4
Badge +13
Hi Thinus,
I noticed that the specified link format does not work on Chrome however Internet Explorer 11 executes just fine.
Thanks
Badge +10

Hi braddo


 


Using a button does make it a bit more tricky, but not impossible.


 


This will again require some scrips (and I am a JQuery novice, so can most probably be improved on)


 


The following might give you something to start with and hopefully get to what you want.


 


Add a button and add a Tooltip i.e. Button1 (Needs to match the script [title='Button1']


Add a Data label, set to literal and add the following text:


<script type="text/javascript">$(document).ready(function() { $("[title='Button1']").click(function() { window.open('file:///ServerShareFile.zip')});});</script>

 


No K2 rules required to make this work.


 


The script can be built up using functions & parameters and passed into the Data Label with a Rule though.


 


What should happen is the script will load on the form and "wait" for the Button to be clicked. When clicked, the specified link will be opened. In this case a file on a network share.


 


And as  RaymondJVR mentioned, it might not work in Chrome.


 


Cheers,


ThinusC

Badge +8

thanks for that

slight mods to the filepath, adding extra slash for escape character but it works

cheers

Reply