Hi!
By merging together cool answer from Marian Hatala: attachments custom validation, together with OOB Nintex features, you can achieve it that way:
- Set name to the "checkbox" field in your repeating section, ex. "EvidenceNeeded"
- Put the following javascript validation method into the "Custom JavaScript" section of your form's settings:
function GetNumberOfAttachments(attCtrlClassName){
return NWF.FormFiller.Attachments.GetAttachedFilesCount(NWF.FormFiller.Functions.GetFillerDivObjectForControl(NWF$("#"+NWF$("." + attCtrlClassName + " .nf-attachmentsRow") 0].id)).data('controlid'))
}
- Set a class name for your attachments field:
- Open "properties"
- Scroll to "Formatting" group
- Add your custom class (you don't need to replace the existing ones) to the "CSS class" attribute, ex.: "AttachedEvidences"
- Set a validation rule to your "Attachment" field:
GetNumberOfAttachments("AttachedEvidences") != sum(EvidenceNeeded)
Where- "AttachedEvidences" is that class name from step no. 3
- EvidenceNeeded is the named control (it has to be named control!) that you set in step no. 1
- Save, run/ preview and you will notice, that your form is properly validated.
Regards,
Tomasz
Elias Hantzis has my solution worked for you? If so, please mark my answer as correct. Thanks!
Regards, Tomasz
Hi Tomasz,
I haven’t had time to implement this solution. My apologies.
Regards,
Elias Hantzis
ICT Administrator
Country Regional Network
Level 1, 20 Smith St, Parramatta NSW 2150
P. 02 9685 5102 | M. 0429 316 344
E. elias.hantzis@jhg.com.au<mailto:elias.hantzis@jhg.com.au> | W. www.jhrcrn.com.au<https://urldefense.proofpoint.com/v2/url?u=http-3A__www.jhrcrn.com.au_&d=DwMFAg&c=lf6PGhmJKTmtyLqIXF-b3g&r=oi-x6Eop3DYWSyK3Jf-DWEBgAuveIetvY3OetEzQWds&m=iulocyipyzo_ZFuzm6Y5X2-1n4dMex3ucEShrZ0eegg&s=OL14ujiwqUNA-ejEfAZjSMPA_PuC5pH8g1eI_daROL4&e=>
No problem. Find your time and post a feedback
The described solution was tested by me and was working fine.
Regards,
Tomasz
Tomasz Poszytek, got any solution for responsive forms?
Nope, I don't. I suggest you to play around with rules. Maybe it would work if you use expressions to count rows and attachments, then to compare both outcomes. But I don't know if that is feasible.
Best regards,
Tomasz Poszytek
e-mail: tomasz@poszytek.eu
tel: +48 603 993 372
www/ blog: https://poszytek.eu
twitter: @TomaszPoszytek
Hi Tomasz Poszytek,
I tried your solution on the responsive form and it's not working. It seems there is no validation at all in this control (even with simple validation rule).
Did you find other solution to this issue?
Regards,
Shiri
Hi,
that solution was indeed for Standard forms, not RWD. If there are no rules to count number of attachments in RWD forms, then there is no way to achieve it. If you need such functionality maybe consider switching back to Standard form?
Regards,
Tomasz
I am curious about whether this solution still works? Both myself and colleague have spent ages trying to get this to work in O365 Classic forms with no success. Following these steps exactly I always get a value of zero returned regardless of how many attachments there are. I need to get this value on the form prior to the first save to properly validate a Save as Draft vs Submit button. I.e. the user should be able to save the form as draft with no attachment but at least one attachment is required to submit.
Elias Hantzis has my solution worked for you? If so, please mark my answer as correct. Thanks!
Regards, Tomasz
It worked perfectly with me,
Many thanks Sir,
Just for clarification, it is better to add to your example this part below:
3.Add your custom class (you don't need to replace the existing ones) to the "CSS class" attribute after a space, ex:
nf-form-label nf-section AttachedEvidences