Launching Attachments in New Window

rss

Posted by maxb57 - Jun 15 ’14 at 08:38

I am investigating Forms Designer to solve the following problem. Right now, when a list edit form is displayed, the user has to right click the attachment link and choose "view in a new window" in order to be able to view the form and the attachment simultaneously. Using Forms Designer (with Sharepoint Online) can I place a button on the form that will launch the attachment in a new window? Let's assume there is only one attachment. What would be even better would be the ability to size both the form and the attachment side by side on the screen so that the user does not have to change window placement themselves.

  • Dmitry Kozlov
    Dmitry Kozlov
    Admin
    Member for: 8 years 2 months 15 days
    #1 by Dmitry Kozlov Jun 17 ’14 at 02:26

    Hello,

    It isn't necessary to open the attachment dialog in a separate window. You can drop Attachments field anywhere onto your form with Forms Designer and view it as well as any other field. If you click Attach File button on the ribbon, you will see a dialog where you can choose the attachment, click OK and return to the form where you will see the selected file and will be able to delete it or choose another one.

    Attachments of the list item

  • Valdas Kalibatas
    Valdas Kalibatas
    Member
    Member for: 5 years 7 months 29 days
    #2 by Valdas Kalibatas Apr 7 ’16 at 08:14

    Hi,

     

    I have the same issue with viewing the attachments. It opens the attached file in the same window. Is here any way to add to the attachment file link the attribute of target="_blank" and make on the click to open in onother window?

     

    Thank you,

    Val

  • rostislav
    rostislav
    Moderator
    Member for: 6 years 7 months
    #3 by rostislav Apr 8 ’16 at 05:25

    [#2]:

    Well, the a element uses an MS function DispDocItemExWithServerRedirect in its onclick attrbitue (check the a element's html) to open attachments. The function treats different attachments differently and there is some logic to it - and I assume it's there for a reason. What you can do is remove the onclick property from the a's DOM and assign target=_blank to it, which will open the attachment as another window - however, do note that this will stop the function from being triggered.

     fd.field('Attachments').control()._el().find('a').removeProp('onclick').prop('target', '_blank');

     

Displaying 1 to 3 of 3 messages