AnsweredAssumed Answered

Validation on multiple attachment control

Question asked by khl151 on Apr 26, 2017
Latest reply on May 4, 2017 by emha

Hi experts, i'm a beginner in Nintex and need help here..

 

I wanted to have 2 attachment controls with following validation respectively, somehow I'm unable to get the correct result. Not sure if anyone can help me out on this..

 

Expected result:

Validation check should be according to the individual attachment control. When Equipment type = FOAK,

both attachment must attach at least 1 document respectively.

e.g:

1st attachment control = 1, 2nd attachment control = 1 --> PASS

1st attachment control = 0, 2nd attachment control = 0 --> FAIL

1st attachment control = 1, 2nd attachment control = 0 --> FAIL

1st attachment control = 0, 2nd attachment control = 1 --> FAIL

 

Actual result:

1st attachment running fine. 2nd attachment is NOT. Validation pass as long as there is an attachment in the form.

e.g.

1st attachment control = 1, 2nd attachment control = 1 --> PASS

1st attachment control = 0, 2nd attachment control = 0 --> FAIL

1st attachment control = 1, 2nd attachment control = 0 --> PASS

1st attachment control = 0, 2nd attachment control = 1 --> FAIL

 

Following are how i configured in the control setting + javascript

1) 1st attachment control (Attachment2)

     - minimum attachment = 1

     - control setting:

2) 2nd attachment control (Attachment_1)

    - minimum attachment = 1 if "Equipment Type" = FOAK

    - control setting for attachment:

   - control setting for Equipment Type:

 

hence, i use JavaScript as below for 2nd attachment control as it can only be done using javascript.

 

function validateAttachments(source, arguments){
 var attCount=NWF$('.nf-attachmentsTable').find('tr').length;
 var statusVal = NWF$('#' + EQType).val();  //NWF$('val-status select').val();

 

 if(statusVal.lastIndexOf("FOAK") >=0 && attCount <1){
    arguments.IsValid = false;
    if (NWF$('.nf-validation-summary').css('display') != 'none'){
         NWF$('.nf-attachment-control').css("border", "red solid 2px");
   }
  }

 

else {
    arguments.IsValid = true;
    {
     NWF$('.nf-attachment-control').css("border", "none");
     }
  }
 
}

 

 

 

Thank you so much..~

Outcomes