You are viewing limited content. For full access, please sign in.

Discussion

Discussion

Check for attachment in each row of collection on Submit

posted on March 18, 2019 Show version history

Hi all,

I'm trying to find a way to have a popup displayed when any of the rows in a Collection are missing an attachment in the attachment field.  Preferably this would mention the attachment missing, which would be specified in the same row under a dropdown box such as 'Agenda' or 'Minutes' selection.  It does prevent the user from submitting since I made it a required field for each row in the collection, but the client would like an actual popup box that says what document is missing rather than just the red error message on the field.  Any help would be greatly appreciated, thanks!

 

 

Rick

0 0
replied on March 19, 2019

I think you can do an each loop on the collection row with an if statement checking to see if there is not an upload doc.

$('.rpx').each(function(){

    if(!$('.rpx #upload').hasClass("file")) {
          alert();
    }

});

 

0 0
replied on March 19, 2019

Yeah it's still not working...I'm used to using tables, I guess it is a lot different with collections, can't seem to get it to get specific rows.

replied on March 19, 2019

I came up with the following, but what happens is it pops up the alert for every description for all 4 types...not just the one that is missing the attachment.  In the below, Field12 is the dropdown description field, and Field14 is the upload attachment field.  Not sure how to specify just the particular row in a collection inside the for loop:


     function Checks(rows)
  {
         
    for (var i = 1; i < parseInt(rows)+1; i++) {
    var ddl = "#Field12\\("+i+"\\) option:selected";
      var upl = "#Field14\\("+i+"\\)";
      
      var theFiles = document.getElementsByClassName("ellipsis").length;
      
   if(theFiles < 4){
     alert($(ddl).text() + " is missing, please upload it now"); 
    
      }
     }
    }
   
    
  $('.Submit').click(function(){
    
    Checks($('.cf-collection').children().length);
    
   
                    
  });

 

You are not allowed to follow up in this post.

Sign in to reply to this post.