I've been following this article on how to conditionally require an attachment on a Nintex form and I haven't had any luck getting it to work. I suspect, because I'm no expert on JavaScript, I've somehow modified the code incorrectly.
What I am trying to do is that if the Status field is set to "Completed" then there must be a minimum of two attachments. I should also explain that the Status field is a drop-down containing a selection of "Completed" along with "Not Started" and "In Process".
Thanks for your assistance.
- function validateAttachments(source, arguments)
- {
- var elm = NWF$(‘.nf-attachmentsTable’);
- var statusValue = NWF$(‘#’ + StatusClientID).val();
- arguments.IsValid = true;if (statusValue == ‘Completed’) {
- if (elm.length > 0 && elm.find(‘tr’).length >= 2) {
- arguments.IsValid = true;
- } else {
- arguments.IsValid = false;
- }}}