asked on June 28, 2020

Hello all,

I have a checkbox collection in two different Collections in the form.  Can someone help me with copying the checked state of the checkbox collection from one to the other similar to the textbox in this thread, https://answers.laserfiche.com/questions/137646/For-Each-Row-Add-Collection.  I have managed to copy the selected index of a dropdown list but unable to figure out the checkbox. 

 

Without a collection, I can copy the checkbox collection between two checkboxes not in a collection as below, just could not figure out in a collection

 

  var chks = [];
   $('.collection1 .choice input[type=checkbox]').each(function() {
       if ($(this).is(":checked")) {
          chks.push($(this).attr('value'));
       }
    });
  
    $('.collection2 .choice input[type=checkbox]').each(function() {
       
    if (chks.includes($(this).attr('value')))
    {
      $(this).prop("checked", true);
      if ($(this).attr('value') == "First")
      {
         setReadOnly($(".first input"), false);
      }
      else if ($(this).attr('value') == "Second")
      {
         setReadOnly($(".second input"), false);
      }
      else if ($(this).attr('value') == "Third")
      {
         setReadOnly($(".third input"), false);
      }
      else if ($(this).attr('value') == "Fourth")
      {
         setReadOnly($(".fourth input"), false);
      }
     
    }
  });

 

Any help would be appreciated.  Thanks in advance.

 

Bala

0 0