Attached Files - ticked by default

Continuing the discussion from Attach PDF for invoices - ticked by default:

Hi @Glenn in the above article from Oct. '15 you provide the script needed to set a tick box as set as default to positive.

This would really be useful for the attaching of files in receipts, as if not ticked then the system calls up files that have already been allocated to another receipt, the option to attach an existing file that you have already uploaded to your Document Manager is a useful additional facility, but hardly ever required.

Can you provide the script that I need to add and where this would best be implemented. We have written about this previously Attach an existing file to multiple purchases

OK the following should work. This will auto-check the box for purchase attachements.


$(document).ready(function() {
   $(".purchase-purchaseView-aspx .imgAttachExistFile").click(function(){
       setTimeout(function(){
            $("#txtfileNameSearch").focus(function(){
                 $("#excAtt").prop("checked",true);
            });
       },1000);
   });
});


1 Like

Hi @Glenn, I have had a go yesterday evening at entering the “script” that you have supplied to get the box ticked by default. You did not advise within which CSS the script should be entered, so had a go in “Global”, “Custom Scripts” and “Purchase Invoice” but none of them got the tick done. Logged out and back in as CSS changes require any update to be registered, but no joy with what you have advised.

Have I missed something simple that I should have done?

For your info. there are already some scripts in “Global” and “Custom”;

Global - script to hide “findAnAccountant”
Custom - script to tick the CC when sending invoices “chkCcMe”

Hi @alan_mcbrien

This would need to go in the Custom Scripts section of the CSS and HTML Customisations.

@Glenn’s code will tick the box as soon as you click into the file name box. Alternatively, you could remove this condition so it’s ticked as soon as you click on the link icon. So it would look like this:

$(document).ready(function() {
   $(".purchase-purchaseView-aspx .imgAttachExistFile").click(function(){
       setTimeout(function(){
            $("#excAtt").prop("checked",true);
       },500);
   });
});

You can just add this to the bottom of the global scripts. It shouldn’t interfere with other code you have there.

Had a go with the suggested script by you @QFMathew but a similar situation, I did not get the tick enabled by default. Had a go by just copying the details from the forum.

Is it a necessity to retype the script within “Custom Scripts”?

If you just PM one of us with your account number we can take a look for you.