Tuesday, September 30, 2014

How to make attachment mandatory in Nintex Form in SharePoint 2010

Lot of times we have requirement to make attachments to a form mandatory in a SharePoint list form. This validation is not available out of the box, although can be achieved very easily by using JQuery. Here is how.
Define the following function in a custom JavaScript file i.e. Validate.js. Include the JQuery and custom validate.js file in Nintex form in the order shown in the below screenshot.


function ValidateForm()
{
//attachment check
if($('.nf-attachmentstable tr').length < 1){
alert("Please attach a file"); 
return false;
}
}


On the submit button set the following as client function:




Here is the result.

Hope this snippet is useful to apply attachment validation in Nintex Forms. Happy coding :)

No comments: