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

Question

Question

Hide collections rows

asked on March 3, 2023 Show version history

The form has no submit button and is strictly a read only form for lookups. I have field rules hiding collection rows but the space and border are still showing. I use a lookup table to fill in all the fields. How can I hide those empty spaces and borders?

 

$(document).on("onloadlookupfinished", function () {
  
  //Run the function when the form is first loaded.
  HideCollectionRows();
  
  //Reusable function that cycles through all rows in collection to determine if they should be hidden.
  function HideCollectionRows()
  {
    $('.myCollectionCheckField').each(function() {
      if($(this).hasClass('hidden'))
      {
        $(this).closest('div.form-q').addClass('hidden');
      }
      else
      {
        $(this).closest('div.form-q').removeClass('hidden');
      }
    });
  }
 
});

Edit: I used this code. It works fine but the load takes a little time.

0 0

Replies

replied on March 6, 2023

Hi Chynna,

 

If I set the field rule to Always hide, then there will be no space and borders between rows; If I set to hide based on some conditions, then it's yes after the condition meets, it just hide the rows but not the borders and spaces, and looks like you are the second case.

alwayshide.PNG
hidenoncondition.PNG
alwayshide.PNG (6.84 KB)
0 0
replied on March 7, 2023

@████████ correct. Is there anyway to hide the borders other than the code I posted above? 

0 0
replied on March 7, 2023

Hi Chynna,

 

If it's the second case, you can watch on the field used to hide the collection and call HideCollectionRows() again, because now the function is only called when lookup rule finished, it won't trigger again when field rule meets, you can do something like:

//monitor your field and when it's clicked or changed.etc, call the function again
$("#YourField").on("change",function(){
HideCollectionRows();
})

 

1 0
replied on March 8, 2023

Ok I will try that as well to see if this will help the timing of the removal. It's just a read only form (no field is editable) nothing will actually be changed, after it runs that first look up. So it sounds like either option will work. I appreciate your help. 

0 0
replied on April 11, 2023

Any tips on how to unhide the div again?

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.