I found a setting in the form which is causing the attachment validation to not work. There is a Save button on the form with InvoiceUpdate(); in the "Client click" field under Advanced settings. When the InvoiceUpdate(): is present the attachment validation doesn't work, when I remove it the validation works perfectly. The "Causes validation" does not change attachment validation as far as my testing went. Below is the button config - DEV on the left and PROD on the right:
Next, I need to try to trace the purpose of InvoiceUpdate(); in PROD before removing it to get the attachment validation I need. Any advice for vetting out the functions of InvoiceUpdate(); in my environment?
I appreciate your continued replies!
Giving a quick lookover your code, it would seem that InvoiceUpdate() is making some kind of ajax call and updating an item in a list elsewhere.
There are a few problems with doing this.
A: It's not particularly easy!
B: You're not preventing the form from submitting, and you're not waiting for the call to finish before figuring out what to do based on its outcome (success / failure / error).
Ideally, the update that you're trying to make should be done inside of a workflow that runs after your item has been updated (IE: Submitted), and that way you're keeping your Form Logic and your SharePoint updates completely separate and can better guarantee that they actually work correctly.
To access the FormData from the Workflow, if the Control is associated to a Column on the List / Library, then it’s as simple as referencing the Current Item’s Column. However, if it isn’t, you can actually access a property called Form Data that is an XML representation of the Controls and their subsequent values. It should be noted however that if you have not NAMED a Control on your form, the XML name that it will be given in that data will simply be a GUID which is not particularly easy to read. So name your controls!