none
Sharepoint 2013 list item attachment field RRS feed

  • Question

  • Hello,

    I have been trying to make attaching documents to list items more user friendly.

    One thing i wanted to change is when user is attaching documents that they can view what document is attached before saving the file. At the moment it only shows the path as text but i would like to to be hyperlink so user can click on it to see the document.

    The optimal solution would be if each row has Open link next to the Delete link but i think this will be even more complicated, so i would be happy enought if the text field would be a link.

    Attached picture to understand more clearly:

    Wednesday, March 1, 2017 8:55 AM

Answers

  • Hi,

    i was able to get it to work as i expected.

    First i found the form.js file in my server and added a href to the place the link is created.

    <span dir="ltr"><a href="file://'+c+'"target="_blank">'+c+"</a></span>

    The only issue left for me is that if user uploads file with spaces it is converted to %20 and then the link cant find the file attached in PC.

    If someone has any suggestions to fix this issue let me know.

    • Marked as answer by Fazzzer Friday, March 3, 2017 7:28 AM
    Wednesday, March 1, 2017 4:16 PM

All replies

  • Hi,

    i was able to get it to work as i expected.

    First i found the form.js file in my server and added a href to the place the link is created.

    <span dir="ltr"><a href="file://'+c+'"target="_blank">'+c+"</a></span>

    The only issue left for me is that if user uploads file with spaces it is converted to %20 and then the link cant find the file attached in PC.

    If someone has any suggestions to fix this issue let me know.

    • Marked as answer by Fazzzer Friday, March 3, 2017 7:28 AM
    Wednesday, March 1, 2017 4:16 PM
  • Hi,

    Seems your filename( variable c) got encoded, you could try to decode it by decodeURI(c).

    https://www.w3schools.com/jsref/jsref_decodeuri.asp

    Best Regards,

    Lee


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Thursday, March 2, 2017 3:08 AM
  • Thanks for the input i will keep it in mind. It is a bit weird i can try the link from my pc with any format and space amount in a document and it works perfectly. I tought it might be because of some weird cache issue but in the pc i found the issue it still exists. Will have to do more testing. But it seems im pretty close to finish.
    Friday, March 3, 2017 7:28 AM
  • Hi,

    it seems the decoding is not the issue. The problem must be somewhere else.

    i am experiancing some weird issue that some files are opening and others not (no clue why) for example i create 2 txt files at same place with basically same names (length is same, and no different characters except for 1 letter). 1 opens and the other one does not. Cant find what the issue might be. The links are correct so i have no clue whats wrong.

    Maybe someone can see what is going on? First one opens second one does not (the order does not matter).

    NB! And the odd thing is, if i change the file names (exchange the names) the file that worked before still works and the music list file that dident work does still not open with even new name, so it seems to be a issue with the exact file not the filename.



    • Edited by Fazzzer Monday, March 6, 2017 8:50 AM
    Monday, March 6, 2017 8:43 AM