¿Cómo mostrar multiples checkbox con “checked” al querer editar o actualizar un registro?

Tengo el fragmento del siguiente código, que lo uso para editar o actualizar registros, el problema esta en que al querer editar en la lista de checkbox (de VACUNAS) cuando tengo mas de un elemento con checked no me salen con el ‘checked’, pero si solo tengo un checked si me sale con el ‘checked’…ESPERO ME PUEDAN AYUDAR!! MUCHAS GRACIAS!

<div>                      <label for="vacunas">Vacunas</label>                      <div class="multiselect">                         <div class="selectBox" onclick="showCheckboxes();">                             <?php                                     include "../conexion.php";                                 $  query_vacunas = mysqli_query($  conection, "SELECT * FROM vacuna");                                 mysqli_close($  conection);                                 $  result_vacunas = mysqli_num_rows($  query_vacunas);                                       include "../conexion.php";                                 $  consulta2 = "SELECT c.cod_correlativo_cerdo as codigo, c.cod_vacuna,                                                 GROUP_CONCAT(v.descrpcion_vacuna SEPARATOR ', ') AS vacunas FROM cerdo c                                                  LEFT JOIN vacuna v ON find_in_set(v.cod_vacuna,c.cod_vacuna)                                                 WHERE cod_correlativo_cerdo = '$  idcerdo'                                                  GROUP BY c.cod_correlativo_cerdo";                                 $  resultados = mysqli_query($  conection, $  consulta2);                                 $  vacunas1 = array();                                  while ($  c = mysqli_fetch_assoc($  resultados)) {                                      $  vacunas1[] = explode(',' , $  c['cod_vacuna'] );                                      //$  vacunas1[] = $  c['cod_vacuna'];                                 }                                 print_r($  vacunas1);                               ?>                             <select name="vacunas" id="vacunas">                                 <option value=" <?php echo $  data['cod_vacuna'];?>"selected><?php echo $  data['vacunas'];?></option>                             </select>                             <div class="overSelect"></div>                         </div>                         <div id="checkboxes" style="border: 1px solid; height: 120px; overflow: hidden scroll; padding: 0px 10px 0px 20px;">                                 <?php                              if ($  result_vacunas > 0)                              {                                     while ($  vacunas = mysqli_fetch_array($  query_vacunas)) {                           ?>                              <label for="vacunas" name="vacunas">                             <input type="checkbox" style="position: absolute; left: -160px;" id="vacunas"                              name="vacunas[]" value="<?php echo $  vacunas["cod_vacuna"]; ?>"                              <?php if (in_array($  data['cod_vacuna'], $  vacunas)) {echo 'checked="checked"'; } ?> >                             <?php echo $  vacunas["descrpcion_vacuna"];?></label>                          <?php                                                }                                            }                          ?>                          </div>                       </div>                                 <script>                 var expanded = false;                 function showCheckboxes(){                     var checkboxes = document.getElementById("checkboxes");                     if (!expanded) {                         checkboxes.style.display = "block";                         expanded = true;                     }else{                         checkboxes.style.display = "none";                         expanded = false;                     }                 }             </script>         </div> 

Asi se muestra… como pueden ver tendo dos registros seleccionanos y no me aparece ninguno con checked

introducir la descripción de la imagen aquí

Aqui solo tengo uno sleccionado y si me aparece con checked

introducir la descripción de la imagen aquí

Question about sorting column A with drop down and column B with checkbox

I have a spreadsheet that I use to run a foosball tournament, and in column A I have a dropdown data validation that will let me select a players name. In Column B I have a checkbox that I check once a player has paid their entry fee.

I have another column in the sheet that takes the values from column A and sorts them into player/teammate, and in order to get a randomized team, I select all players in column A and do a randomize sort on that range. However, the checkbox in column B does not follow where the data in column A goes, mixing up who has paid and who hasnt.

Is there a way to make it keep column B selection matched up with the player name in column A?

I have searched quite a bit on this but havent come across anything helpful.

Thank you.

How to select all checkbox in mvc through javascript. Changing also a Boolean in the model

   $  ("#chkSelectAllClienteArquivo").bind("change", function () {          $  (".chkSelectClienteArquivo").prop("checked", $  (this).prop("checked"));         debugger;              })       $  (".chkSelectClienteArquivo").bind("change", function () {         var numChecked = 0;         var numchk = $  ('.chkSelectClienteArquivo:checkbox').length;         //debugger;         var id = $  (this).attr("data-id");         var index = $  (this).attr("data-index");         var trClienteArquivo = $  (("#trclientearquivo_" + id));         debugger;          trClienteArquivo.find("input[type=hidden][id*='clientes_" + index + "__selecionado']").val($  (this).prop("checked"));          $  ('.chkSelectClienteArquivo:checkbox:checked').each(function (i) {             if ($  (this).prop("checked")) {                 numChecked++;             }         });          if (numChecked == 0) {             $  ("#chkSelectAllClienteArquivo").prop('indeterminate', false);             $  ("#chkSelectAllClienteArquivo").prop("checked", false);         }         else if ((numChecked > 0) && (numChecked < numchk)) {             $  ("#chkSelectAllClienteArquivo").prop('indeterminate', true);         }         else if (numChecked == numchk) {             $  ("#chkSelectAllClienteArquivo").prop('indeterminate', false);             $  ("#chkSelectAllClienteArquivo").prop('checked', true);         }     })
<table id="tableclientesarquivos" class="table">     <thead style="vertical-align:top; text-align:center;">         <tr>             <th>Incluir no Projeto<br /> <input type="checkbox" id="chkSelectAllClienteArquivo" /></th>             <th>Grupo Econômico</th>             <th>CNPJ</th>             <th>Nome</th>             <th>Inscrição Estadual</th>         </tr>     </thead>     <tbody id="tablebodyclientesarquivos">          @foreach (var cliente in Model)         {             trId = string.Format("trclientearquivo_{0}", cliente.Cnpj);              <tr id="@trId">                 @Html.Hidden(string.Format("clientes[{0}][Cnpj]", index), cliente.Cnpj)                 @Html.Hidden(string.Format("clientes[{0}][Nome]", index), cliente.Nome)                 @Html.Hidden(string.Format("clientes[{0}][InscricaoEstadual]", index), cliente.InscricaoEstadual)                 @Html.Hidden(string.Format("clientes[{0}][selecionado]", index), cliente.selecionado)                 @Html.Hidden(string.Format("clientes[{0}][CodigoUF]", index), cliente.CodigoUF)                 @Html.Hidden(string.Format("clientes[{0}][CodMunicipio]", index), cliente.CodMunicipio)                  <td>                     <input type="checkbox" id="chkSelect_@cliente.Cnpj" class="chkSelectClienteArquivo" data-id="@cliente.Cnpj" data-index="@index" />                 </td>                 <td>                     @if (cliente.grupoeconomico != null)                     {                         @cliente.grupoeconomico.greNome                                             @Html.Hidden(string.Format("clientes[{0}][grupoeconomico.greCodigo]", index), cliente.grupoeconomico.greCodigo)                         @Html.Hidden(string.Format("clientes[{0}][grupoeconomico.greNome]", index), cliente.grupoeconomico.greNome)                     }                     else                     {                         <button type="button" id="button_@cliente.Cnpj" data-id="@cliente.Cnpj" onclick='OnGrupoEconomicoClick(this)'>Cadastrar</button>                                                @Html.Hidden(string.Format("clientes[{0}][grupoeconomico.greCodigo]", index), null)                         @Html.Hidden(string.Format("clientes[{0}][grupoeconomico.greNome]", index), "")                     }                 </td>              </tr>              index++;         }      </tbody> </table>

I want it when I click on: chkSelectAllClientFile change the client.selected model = true

QUAD checkbox needs

I have read discussion about tri-state checkboxes and even those are controversial – we have an even more complex problem with our software. We need 4 options and can’t figure out best way to do this in a logical fashion. I have read over and over that a parent should not be selectable without any children being selected. For us, this just does not hold true. Sample hierarchy below. A user might be a member of the parent, or any of the children, but not both. We need a way to

A) easily select checkboxes to filter and locate users of any of these scenarios:

B) Have some way to visually show the user that different items are selected without having to expand the tree.

1) Parent ALONE (since they may not be a member of the child org)
2) Child ALONE (since being in child org does not mean you are member of parent org, just simply that your org reports to the parent)
3) ALL children (without parent – there may be up to 20 children so selecting each individually takes too much time)
4) ALL – parent plus children

This issue comes up again and again – even with the tri-state checkbox option, we still have no easy way to toggle between these options. I would welcome any ideas no matter how random! We train our customers specifically on all items in our system, so if not instantly intuitive, time saving functionality in this case is more important than extra training!!!

Thank you!

sample hierarchy

How to display a block if a Boolean on/off checkbox is checked?

I will eventually install Panels to accomplish this. But I can’t at this time. I want to allow an editor to display a right sidebar menu on any page when they want by checking a Single on/off checkbox . I added a CCK field to the Page type – Boolean -Single on/off checkbox. I am using Drupal 7.43 on Centos 7 and php 5.4

There is a php block invoke inside another php that checks if a cck field is not null. The first php is looking at the Boolean field ‘field_hide_sidebar_menu’ to see if it is null or not checked. If it is null it will display the block. This is not working. I have used ‘if!empty’ before to check if an image field is null and it works. Now I want it to check if the Boolean is checked or not checked so do I need to write this in a different way to check if the Boolean value is on or off – equal to 1 or equal to 0. Here is my code:

<?php if (!empty($  entity['field_hide_sidebar_menu'])): ?> <div id="myclass"> <h2>Menu</h2> <?php $  block = module_invoke('views', 'block_view', 'menu_sidebar-block_1'); print render($  block['content']);?></div><?php  endif; ?> 

How to keep a checkbox value to reuse it later in GoogleSheet

I’m working on a googlesheet actualy (only for fun) and i’m actually stuck on something, like i said in the title, i want to keep a checkbox value in googlesheet.

I will explain my problem.

I’m doing a sheet of some information who will appear when i change the value of a dropdown list. But i want to be able to check a checkbox in one Dropdown item and when i change this item, have the checkbox who will take the value of the other item. A little exemple :

I have 2 dropdown item: one called poney and the other called horse, i check the checkbox while i was in poney and i change to horse. I want the checkbox value go to false and when i go back to poney the checkbox retake the value true

I hope someone can help me about that !

Изменение размера “галочки” checkbox wpf

Уже не первый день бьюсь с данной мне проблемой. При изменении FontSize у CheckBox в WPF, текст изменяет свой размер, но окошко с галочкой остается без изменений. И очень неприятно работать с вот с таким вот контролом:

введите сюда описание изображения

В англоязычном SO нашёл вот такой кусочек разметки, которая как я понял переопределяет ПОЛНОСТЬЮ CheckBox. И где-то там и размеры окошка для галочки. Но галочка не меняет размер. И при добавлении вот этого кода в ресурсы (кода много, скрываю):

    <Style x:Key="FocusVisual">         <Setter Property="Control.Template">             <Setter.Value>                 <ControlTemplate>                     <Rectangle Margin="2"                                SnapsToDevicePixels="true"                                Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"                                StrokeThickness="1"                                StrokeDashArray="1 2" />                 </ControlTemplate>             </Setter.Value>         </Setter>     </Style>     <SolidColorBrush x:Key="OptionMark.Static.Background"                      Color="#FFFFFFFF" />     <SolidColorBrush x:Key="OptionMark.Static.Border"                      Color="#FF707070" />     <Style x:Key="OptionMarkFocusVisual">         <Setter Property="Control.Template">             <Setter.Value>                 <ControlTemplate>                     <Rectangle Margin="14,0,0,0"                                SnapsToDevicePixels="true"                                Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"                                StrokeThickness="1"                                StrokeDashArray="1 2" />                 </ControlTemplate>             </Setter.Value>         </Setter>     </Style>      <SolidColorBrush x:Key="OptionMark.MouseOver.Background"                      Color="#FFF3F9FF" />     <SolidColorBrush x:Key="OptionMark.MouseOver.Border"                      Color="#FF5593FF" />     <SolidColorBrush x:Key="OptionMark.MouseOver.Glyph"                      Color="#FF212121" />     <SolidColorBrush x:Key="OptionMark.Disabled.Background"                      Color="#FFE6E6E6" />     <SolidColorBrush x:Key="OptionMark.Disabled.Border"                      Color="#FFBCBCBC" />     <SolidColorBrush x:Key="OptionMark.Disabled.Glyph"                      Color="#FF707070" />     <SolidColorBrush x:Key="OptionMark.Pressed.Background"                      Color="#FFD9ECFF" />     <SolidColorBrush x:Key="OptionMark.Pressed.Border"                      Color="#FF3C77DD" />     <SolidColorBrush x:Key="OptionMark.Pressed.Glyph"                      Color="#FF212121" />     <SolidColorBrush x:Key="OptionMark.Static.Glyph"                      Color="#FF212121" />     <Style TargetType="{x:Type CheckBox}">         <Setter Property="FocusVisualStyle"                 Value="{StaticResource FocusVisual}" />         <Setter Property="Background"                 Value="{StaticResource OptionMark.Static.Background}" />         <Setter Property="BorderBrush"                 Value="{StaticResource OptionMark.Static.Border}" />         <Setter Property="Foreground"                 Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />         <Setter Property="BorderThickness"                 Value="1" />         <Setter Property="Template">             <Setter.Value>                 <ControlTemplate TargetType="{x:Type CheckBox}">                     <Grid x:Name="templateRoot"                           Background="Transparent"                           SnapsToDevicePixels="True">                         <Grid.ColumnDefinitions>                             <ColumnDefinition Width="Auto" />                             <ColumnDefinition Width="*" />                         </Grid.ColumnDefinitions>                         <Grid VerticalAlignment="Center">                             <Border x:Name="checkBoxBorder"                                     BorderBrush="{TemplateBinding BorderBrush}"                                     BorderThickness="{TemplateBinding BorderThickness}"                                     Background="{TemplateBinding Background}"                                     HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"                                     Margin="1"                                     VerticalAlignment="{TemplateBinding VerticalContentAlignment}">                                 <Grid x:Name="markGrid"                                       VerticalAlignment="Center">                                     <Path x:Name="optionMark"                                           Data="F1 M 9.97498,1.22334L 4.6983,9.09834L 4.52164,9.09834L 0,5.19331L 1.27664,3.52165L 4.255,6.08833L 8.33331,1.52588e-005L 9.97498,1.22334 Z "                                           Fill="{StaticResource OptionMark.Pressed.Glyph}"                                           Margin="5"                                           Opacity="0"                                           Stretch="Uniform" />                                     <Rectangle x:Name="indeterminateMark"                                                Fill="{StaticResource OptionMark.Static.Glyph}"                                                Margin="2"                                                Opacity="0" />                                 </Grid>                             </Border>                         </Grid>                         <Grid VerticalAlignment="Center" Grid.Column="1">                             <ContentPresenter x:Name="contentPresenter"                                               Grid.Column="1"                                               Focusable="False"                                               HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"                                               Margin="{TemplateBinding Padding}"                                               RecognizesAccessKey="True"                                               SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"                                               VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />                         </Grid>                     </Grid>                     <ControlTemplate.Triggers>                         <Trigger Property="HasContent"                                  Value="true">                             <Setter Property="FocusVisualStyle"                                     Value="{StaticResource OptionMarkFocusVisual}" />                             <Setter Property="Padding"                                     Value="4,-1,0,0" />                         </Trigger>                         <Trigger Property="IsMouseOver"                                  Value="true">                             <Setter Property="Background"                                     TargetName="checkBoxBorder"                                     Value="{StaticResource OptionMark.MouseOver.Background}" />                             <Setter Property="BorderBrush"                                     TargetName="checkBoxBorder"                                     Value="{StaticResource OptionMark.MouseOver.Border}" />                             <Setter Property="Fill"                                     TargetName="optionMark"                                     Value="{StaticResource OptionMark.MouseOver.Glyph}" />                             <Setter Property="Fill"                                     TargetName="indeterminateMark"                                     Value="{StaticResource OptionMark.MouseOver.Glyph}" />                         </Trigger>                         <Trigger Property="IsEnabled"                                  Value="false">                             <Setter Property="Background"                                     TargetName="checkBoxBorder"                                     Value="{StaticResource OptionMark.Disabled.Background}" />                             <Setter Property="BorderBrush"                                     TargetName="checkBoxBorder"                                     Value="{StaticResource OptionMark.Disabled.Border}" />                             <Setter Property="Fill"                                     TargetName="optionMark"                                     Value="{StaticResource OptionMark.Disabled.Glyph}" />                             <Setter Property="Fill"                                     TargetName="indeterminateMark"                                     Value="{StaticResource OptionMark.Disabled.Glyph}" />                         </Trigger>                         <Trigger Property="IsPressed"                                  Value="true">                             <Setter Property="Background"                                     TargetName="checkBoxBorder"                                     Value="{StaticResource OptionMark.Pressed.Background}" />                             <Setter Property="BorderBrush"                                     TargetName="checkBoxBorder"                                     Value="{StaticResource OptionMark.Pressed.Border}" />                             <Setter Property="Fill"                                     TargetName="optionMark"                                     Value="{StaticResource OptionMark.Pressed.Glyph}" />                             <Setter Property="Fill"                                     TargetName="indeterminateMark"                                     Value="{StaticResource OptionMark.Pressed.Glyph}" />                         </Trigger>                         <Trigger Property="IsChecked"                                  Value="true">                             <Setter Property="Opacity"                                     TargetName="optionMark"                                     Value="1" />                             <Setter Property="Opacity"                                     TargetName="indeterminateMark"                                     Value="0" />                         </Trigger>                         <Trigger Property="IsChecked"                                  Value="{x:Null}">                             <Setter Property="Opacity"                                     TargetName="optionMark"                                     Value="0" />                             <Setter Property="Opacity"                                     TargetName="indeterminateMark"                                     Value="1" />                         </Trigger>                     </ControlTemplate.Triggers>                 </ControlTemplate>             </Setter.Value>         </Setter>     </Style>

CheckBox обретает вот такой вид:

введите сюда описание изображения

Кажется что лучше, но до тех пор пока не поставишь галочку:

введите сюда описание изображения

И как то выглядит не очень. Как по мне выглядит это примерно вот так:

введите сюда описание изображения

Думаю ясно описал проблему. Спасибо за выделенное время для меня.

Drupal 7 Validating Tableselect: Checkbox

I have a form in which i have created a table like the following

$ form['tableselect_phone'] = array( '#type' => 'tableselect', '#header' => $ header, '#options' => $ options, '#empty' => t('No content available.'),

In $ options I am passing an array with sl no., UID, name etc. So now on the UI, I have an table with headers Sl no., UID, name & Phone Number. Here Phone Number is an empty textbox to fill in. When I click on the checkbox of the first user and assign a value for phone number and after that if I do not click on the second checkbox and enter value text-box for phone number, the value gets assigned for both when i click on submit button. Whereas it should not get entered of the second one. It should throw an error. For validation I have done hook_form_validate. But I am not able to do it properly. Here is what i wrote

function phone_form_validate($ form, &$ form_state){ $ values = $ form_state['input']; if(!array_filter(array_values($ values["tableselect_phone"]))) { form_set_error("tableselect_phone", t("Please select user to enter phone number "));

Description based on each checkbox “checked” to populate into a summary on the 2nd tab (sheet)

I am building a spreadsheet that has to tab (sheets), the 1st I have an “assessment checklist” with about 250-30 checkboxes based on what is found. Example (Checkbox is in “A” column and description is in “B” column). I would like the description based on each checkbox “checked” to populate into a summary on the 2nd tab (sheet).

Is this something that can be accomplished at all, and is this something that can be done using a running report with a date?

For instance (Date 1/1/11 and summary in column “A of sheet two”, Date 1/18/11 and summary in column “B of sheet two”… etc.