Nintex for SharePoint Forum
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
Showing results for
I have need for very custom validation on an attachment field.
We have a series of cascading drop down menus that make the attachment field visible based on the selections. When the conditions that make the attachments visible I want to require an attachment. When the attachments are not visible, I don't want attachments to be required.
Anyone have a good way to go about setting this up? I don't see any way to do this with any of the out of the box functions and validation doesn't seem to work with rules either. I put a real simple condition like "IsEmptyOrNull" in the conditional validation field, and if I open the form initially then click save that validation kicks off, invalidates the form and puts my custom error message up, but the moment I select one of the cascading drop down options, the form "refreshes" and when I try to save the form, the attachment validation passes (even though I have not attached anything).
Solved! Go to Solution.
Have you seen this? >>> Nintex Forms - Attachment Required - Vadim Tabakman
It does not cover conditional attachment validation only that it is required or not overall. Yes I have seen it.
I have written myself small javascript function that returns me number of attachemnets.
function GetNumberOfAttachments(attCtrlClassName){
return NWF.FormFiller.Attachments.GetAttachedFilesCount(NWF.FormFiller.Functions.GetFillerDivObjectForControl(NWF$("#"+NWF$("." + attCtrlClassName + " .nf-attachmentsRow")[0].id)).data('controlid'))
}
then I simply use it in validation rules like
GetNumberOfAttachments("AttachmentControlClass") < 1
that allows me to combine it with other needed logic
attachments custom validation number of attachments
While this is nice, no where in my question did I ask for validation for the number of attachments. Where exactly are you going with this? I think this may be something you should put in a separate article or something as this is unrelated to my question.
you asked for:
When the conditions that make the attachments visible I want to require an attachment. When the attachments are not visible, I don't want attachments to be required.
number of attachments less than 1 means there is no attachment.
if you AND that with condition that makes your attachment control visible and place that combined condition into validation rule, once the control is visible and no attachment is included your form will not validate.
is it clear now?
Yes this makes more sense. I hadn't considered that method. Thanks for the clarification.
That's great, that's what I need!
Unfortunately I was not able to get this solution to work for me. I was out until recently due to surgery and I haven't been able to explore further options yet.