AnsweredAssumed Answered

Cannot get Attachment Validation to Work

Question asked by gdgonzal on Dec 14, 2017
Latest reply on Dec 18, 2017 by emha

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.

  1. function validateAttachments(source, arguments)
  2. {
  3. var elm = NWF$(‘.nf-attachmentsTable’);
  4. var statusValue = NWF$(‘#’ + StatusClientID).val();
  5. arguments.IsValid = true;if (statusValue == ‘Completed’) {
  6. if (elm.length > 0 && elm.find(‘tr’).length >= 2) {
  7. arguments.IsValid = true;
  8. } else {
  9. arguments.IsValid = false;
  10. }}}


Status field config