Validation is a crucial piece of functionality for almost any form. As a designer of a form I want to ensure that only data that meet certain criteria can be entered and, as I define my columns, SharePoint gives me some of that functionality out of the box. So… that’s great, right?
Almost. There is one critical area of data input where there is almost no straightforward way to validate that the right kind of data is being submitted: SharePoint’s attachment functionality. Aside from a central set of disallowed attachment file formats and some limitations on attachment sizes, a user really can add as many (including zero) of whatever attachment type he or she likes.
An example where attachment validation is important might be a Job Application Form. Typically, a job application requires a résumé to be attached. Sounds simple. But behind this simple request are actually a couple of implications that are critical in ensuring that anyone downstream in the workflow from this submission is getting the right information:
The latest version of Nintex Forms for SharePoint includes validation for attachments baked in to the Attachment Control. A new “Validation” section in the Attachment Control settings is now available. You’ll see that it allows the designer of the form to:
You’ll also see that you can define validation messages where the minimum number of files have not been submitted and where an incorrect file format is being submitted.
So how does this work in practice?
This one is pretty clear-cut. If the user tries to submit a form without the minimum number of attachments specified, then the form will not be submitted and the user is presented with a validation message. In the example above, I have specified that at least one attachment is required and I’ve set a custom validation message of “Résumé must be attached.”
Also, where the minimum number of files is greater than zero, we treat the control as a required field and the connected label is marked with a red asterisk to denote the attachment control as “required”.
This one is even easier. The designer of the form can leave the Maximum Attachment Setting to “Unlimited” which is the default. In the example above, however, I’ve said that I don’t want a user to submit any more than one attachment. So, what happens if they try?
At runtime, once the number of attachments has reached the maximum number specified, the “Add Attachment” button on the form becomes disabled and is grayed-out so that no more files can be attached.
This also means that a validation message is not required for the user. However, we would recommend that, where there is ambiguity, the form designer make it clear in the form that there is a maximum number of attachments allowed.
If left blank, any file format is allowed. However, as soon as any extensions are entered into this list, then this acts as a whitelist. Nintex Forms will not allow any files with an unlisted file extension to be uploaded. In the example above, I’ve stated that only files with the extension doc, docx or pdf will be allowed.
The way validation works here is a bit different. It’s not that Nintex Forms stops the submission of the form, it actually prevents the attachment at upload time – before the user even submits the form. When the user attempts to upload a disallowed file type, then a dialog box appears with my custom validation message. The file is not even uploaded.
So that’s it: our new attachment validation in action.
We really hope you like it and we’re looking forward to making validation for attachments even more flexible. In the not too distant future we hope to deliver the ability to set Validation Rules for attachments as well, offering the same sort of conditional validation to attachments as we do to our other controls. We are also, of course, planning to include this functionality in Nintex Forms for Office 365 as well. Stay tuned.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.