rdpDen
Scholar

Re: SharePoint Nintext NewForm Custom Javascript Require Attachment

Jump to solution

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:

SubbitButton.png

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?

 

My original post is the Custom JavaScript from the form settings and includes some functions associated with InvoiceUpdate(); and I wonder if that JavaScript can be adjusted to validate attachments or at least stop causing the OOB validation to not work.

 

I appreciate your continued replies!

0 Kudos
Reply
MegaJerk
Collaborator

Re: SharePoint Nintext NewForm Custom Javascript Require Attachment

Jump to solution

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!

0 Kudos
Reply