• Resolved stivenson2005

    (@stivenson2005)


    Hi, I know i post a lot recently here, im sorry if its too much.

    I was wondering, if there is a possibility where its possible to add a checkbox that checks all the boxes in the same field?

    like so

    [x] Check all

    X Sample 1
    X Sample 2
    X Sample 3
    X Sample 4

    and that check all will check all the boxes underneath it.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @stivenson2005

    You can try this javascript snippet:

    
    jQuery(document).ready(function() {
       var $dom = jQuery("div[data-key='testcheckbox']")
          .find(".um-field-area")
          .find(".um-field-checkbox");
    
       var um_cb_loaded = false;
    
       $dom.first().on("change", function() {
          if (um_cb_loaded) {
             var is_checked = jQuery(this).hasClass("active");
    
             $dom.each(function(i, dd) {
                var me = jQuery(this);
                if ("Check All" !== me.find("input[type=checkbox]").val()) {
                   if (!is_checked) {
                      me.find("input[type=checkbox]").prop("checked", true);
                      me.find("span.um-field-checkbox-state i").addClass("um-icon-android-checkbox-outline");
                      me.find("span.um-field-checkbox-state i").removeClass("um-icon-android-checkbox-outline-blank");
                      me.find(".um-field-checkbox.active").removeClass("active");
                   } else {
                      me.find("input[type=checkbox]").prop("checked", false);
                      me.find("span.um-field-checkbox-state i").removeClass("um-icon-android-checkbox-outline");
                      me.find("span.um-field-checkbox-state i").addClass("um-icon-android-checkbox-outline-blank");
                      me.find(".um-field-checkbox").addClass("active");
                   }
                }
             });
          }
    
          um_cb_loaded = true;
       });
    });
    

    You need to change the Check All with your own first checkbox. Also, you need to change the testcheckbox to your field key.

    Regards,

    Thread Starter stivenson2005

    (@stivenson2005)

    Thanks lot for your response, I will give it a try and really appreciate all the help i get, and this plugin and its functionalities.

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hey there!

    This thread has been inactive for a while so we’re going to go ahead and mark it Resolved.

    Please feel free to re-open this thread by changing the Topic Status to ‘Not Resolved’ if any other questions come up and we’d be happy to help. ??

    Regards,

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Check all boxes?’ is closed to new replies.