Page 1 of 1

open attachment in new form but delte in _self

Posted: 12 Oct 2021
by keusch
Hello,
I've adapted the attachments control with the following Java script:

Code: Select all

fd.field('Attachments').control()._el().find('a').removeProp('onclick').prop('target','_blank');
Which works fine for displaying an attachment in a new browser window but it also sets the delete link to target _blank which blocks the delete function - is there a way to only adapt the link of the attachment to be opened in a new window(_blank) and leave the delete link as it originally is?
best regards
Christian

Re: open attachment in new form but delte in _self

Posted: 13 Oct 2021
by mnikitina
Hello keusch,

You can try out this code:

Code: Select all

var attachmentsLink = fd.field('Attachments').control()._el().find('a');

for (var i = 0; i < attachmentsLink.length; i++) {
    
    if(i % 2 === 0){
        $(attachmentsLink[i]).removeProp('onclick').prop('target','_blank');
    }
}

Re: open attachment in new form but delte in _self

Posted: 14 Oct 2021
by keusch
Thank you works fine.