Solved

How do you set attachements to open in a new window?


Hi, I currently have nintex mobile forms setup for audit purposes. In these there is the ability to capture photograhs. These forms are being sent into sharepoint for all central parties to see. When viewing the forms there is the ability to click onto the attacments for which open in the same window which means a lot of clicking back and forth and reloading of the browser. Is there a way I can set these attacments to open in a new window to avoid this pain? Thanks

icon

Best answer by andrew_x_childr 23 May 2017, 00:40

View original

10 replies

Badge +5

I'm using Nintex forms on premises, so this might not be applicable to the mobile version, but I've come up with a custom JavaScript solution that will make attachments open in a new tab:

NWF$("document").ready(function() {
NWF$('[id*="idAttachmentsTable"]').click(function() {
NWF$('tbody tr td a').attr("target", "_blank");
});
});

Andrew. Seems quite simple so thanks for this.

Where in the NINTEX form creator is best for this code to be placed? Would this go into the "Custom Java Script" in Form Settings, under "Custom CCS includes" within Advanced or "Custom Javascript includes" within the Advanced tab?

Thanks again

Badge +5

Tweaking it this morning, this version of the code is simpler and also works:

NWF$("document").ready(function() {
 NWF$('tbody tr td a').attr("target", "_blank");
});
Badge +5

The first option, in Custom JavaScript under Custom CSS in Form Settings.  I will be interested to know if this works for you on Nintex Mobile.

Badge +1

thanks, that looks like a good fix Andrew, I have tried it on premises, but cant get it to behave.  Am I missing something?  I have put the code into custom javascript.  A form opened in read mode with an attached pdf still opens in the same window, requiring back to go back to the form. 

Andrew, thanks for the response and resolution. I did try this and could not get this to work either.

A simple solution got me around this without having to alter any custom scripting at all. Simply hold CTRL when clicking on the image and it opens in a new web page.

Simple but effective.

Badge +11

This works great provided the user does not click the Add Attachment link as below otherwise there is a problem.

However, if the user clicks the add attachment icon instead then it works.

Hint: maybe adding the .pdf only attribute would rule it out??

Badge +7

I have the On Prem version and it works perfectly for m me.

NWF$("document").ready(function() {


    NWF$('[id*="idAttachmentsTable"]').click(function() {


        NWF$('tbody tr td a:nth-child(1)').attr("target", "_blank");


    });


});


 


Needs the :nth-child(1) on a element so you can delete a saved attachment.


The :nth-child(1) catches only the attachment link and not the whole element

Badge +1

Thank you, Papasotiriou!!  This was needed for us to still be able to delete saved attachements… much appreciated!

Reply