Checkbox All Specific

Asked

Viewed 39 times

0

I’m using javascript on a "Mark All" button to mark all checkbox of my system, however, now I would like to mark only the checkbox of a specific block or of a specific enterprise that defines each block. Companies are being listed through a loop, I can not only mark the checkbox of a specific company, is marking all.

Does anyone have a solution? From now on, thank you!

 /* Lista Empresas */
                    foreach($listarempresa as $empresa){

                        $listaremail = listarEmails($conexao,$empresa["empresaid"]);
                        ?>

                <!--Oculta Elementos-->
                <script>
                        $(document).ready(function(){
                        $("#empresa<?=$empresa["empresaid"]?>").css("display", "none");
                        });
                </script>
                  <div class="collection">
                   <a href="#!" class="collection-item" data-element="#empresa<?=$empresa["empresaid"]?>" style="color:#005129; font-size:13px;"><?=$empresa["empresa"]?><span class="badge">
                                <?=totalEmail($conexao,$empresa["empresaid"])?></span></a></div>

                <div id="empresa<?=$empresa["empresaid"]?>">
                   <?php 
                   $i = 0;
                   ?>
                        <!-- Lista Emails de uma Empresa especifica através da chave empresaid -->
                       <?php foreach($listaremail as $emails){

                    if($empresa["empresaid"] == $emails["empresaid"]){?>

           <p>
               <input type="checkbox"  name = "email<?=$i?>[]" value="<?=$emails["endemail"]?>" id="teste5<?=$i?>" />
               <label for="teste5<?=$i?>" style="font-size:13px"><?=$emails["nome"]." ("?><?= $emails["endemail"].")"?></label>
           </p>              

                <?php $i++; }?>

                 <?php   } ?>


              <div class="switch">
                  <!-- Botão Marcar Todos -->
    <label>
      <input type="checkbox" onclick="marcarTodos(this.checked);" name="email0[]" id="teste5<?=$i?>">
      <span class="lever"></span>
      <label for="checkall" style="font-size:14px;"></label>
    </label>
             </div>
                      </div>

            <?php  

                    }

I would like him to mark only the emails listed according to the company, and he is marking all emails from all companies.

 /* Lista Empresas */
                    foreach($listarempresa as $empresa){

                        $listaremail = listarEmails($conexao,$empresa["empresaid"]);
                        ?>

                <!--Oculta Elementos-->
                <script>
                        $(document).ready(function(){
                        $("#empresa<?=$empresa["empresaid"]?>").css("display", "none");
                        });
                </script>
                  <div class="collection">
                   <a href="#!" class="collection-item" data-element="#empresa<?=$empresa["empresaid"]?>" style="color:#005129; font-size:13px;"><?=$empresa["empresa"]?><span class="badge">
                                <?=totalEmail($conexao,$empresa["empresaid"])?></span></a></div>

                <div id="empresa<?=$empresa["empresaid"]?>">
                   <?php 
                   $i = 0;
                   ?>
                        <!-- Lista Emails de uma Empresa especifica através da chave empresaid -->
                       <?php foreach($listaremail as $emails){

                    if($empresa["empresaid"] == $emails["empresaid"]){?>

           <p>
               <input type="checkbox"  name = "email<?=$i?>[]" value="<?=$emails["endemail"]?>" id="teste5<?=$i?>" />
               <label for="teste5<?=$i?>" style="font-size:13px"><?=$emails["nome"]." ("?><?= $emails["endemail"].")"?></label>
           </p>              

                <?php $i++; }?>

                 <?php   } ?>


              <div class="switch">
                  <!-- Botão Marcar Todos -->
    <label>
      <input type="checkbox" onclick="marcarTodos(this.checked);" name="email0[]" id="teste5<?=$i?>">
      <span class="lever"></span>
      <label for="checkall" style="font-size:14px;"></label>
    </label>
             </div>
                      </div>

            <?php  

                    }
  • 2

    I believe that showing the HTML of how the checkbox and your group are doing can help.

  • Enter the code you are using and as if possible a print of how Voce would like it to stay.

  • I would like him to mark only the emails listed according to the company, and he is marking all emails from all companies. The code is found in the link:http://pastebin.com/wZVjnix9

  • You have to report if there is a link between what will be branded and companies, as well as a differentiation between the companies themselves. This will be set in the values of id and rel checkbox

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.