cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Re: attachments custom validation

Jump to solution

Get well soon! Follow up with your progress when you can.

Best!

Frank

0 Kudos
Reply
Workflow Hero

Re: attachments custom validation

Jump to solution

Just following up to see if the issue was resolved. It would help others if they can find the correct answer from this post.

Reply
Workflow Hero

Re: attachments custom validation

Jump to solution

Unfortunately the project was scrapped and worked on by another team so I was not able to implement any of this myself. I cannot validate the solution above works or not. Maybe someone else will use it and validate it.

0 Kudos
Reply
Workflow Hero

Re: attachments custom validation

Jump to solution

solution has already been verified by several other threads

https://community.nintex.com/search.jspa?q=GetNumberOfAttachments 

#BRGreview

0 Kudos
Reply
Workflow Hero

Re: attachments custom validation

Jump to solution

This is exactly what I'm looking to do. I have the script in form settings > custom js, but when I get no results from a form variable when I add the formula = GetNumberOfAttachments("attCtrl"). "attCtrl" is the class on each attachment control

0 Kudos
Reply
Workflow Hero

Re: attachments custom validation

Jump to solution

sounds to be some different/specific problem.

I'd encourage you to start new question and describe full details of your setup, error(s) you get, etc.

Reply
Highlighted
Workflow Hero

Re: attachments custom validation

Jump to solution

 I have a attachment requirement condition on my form and attached a copy of my form if anyone wants to give it a try.

Step 1: Go into the form settings and paste this code below into the Custom JavaScript text box.

function GetNumberOfAttachments(attCtrlClassName){  
    return NWF.FormFiller.Attachments.GetAttachedFilesCount(NWF.FormFiller.Functions.GetFillerDivObjectForControl(NWF$("#"+NWF$("." + attCtrlClassName + " .nf-attachmentsRow")[0].id)).data('controlid'))
 } 

Step 2: Select the attachments control and create a validation rule like below on the attachments control.

RequestType == "New Badge or Name Change" && GetNumberOfAttachments("this is the CSS Class on the attachment control") <1

My Valadation Rule: RequestType == "New Badge or Name Change" && GetNumberOfAttachments("nf-form-input") <1

Reply
Workflow Hero

Re: attachments custom validation

Jump to solution

The solution works in a form list, but does not in task nintex form. This is my configuration:

Custom JS:

Control:

Rule:

Reply
Workflow Hero

Re: attachments custom validation

Jump to solution

Hi Marian

It seems your function works for a form validation rule, but not a formatting (hide/disable) rule. I couldn't get it to work with the latter.

I need to hide a field for as long as GetNumberOfAttachments("AttachmentControlClass") < 1. How can we get this to work?

0 Kudos
Reply
Workflow Hero

Re: attachments custom validation

Jump to solution

it doesn't matter whether you use the formula/script for formatting or validation rule. 

they are evaluated just the same way behind the scene.

check for other possible problems/errors on the form.

0 Kudos
Reply