Que tal, recurro de nuevo a uds ya que me surgio el siguiente inconveniente. Obtengo datos de 2 tablas distintas desde Mysql y los muestro en 2 tablas dinamicas, valido que esten selecionados al menos un checkbox por cada tabla, el detalle surge ya que necesito saber "Cuantos checkbox fueron seleccionados por Tabla dinamica y pasarlos a JA_vatos.php (Nombre de prueba Xd)" pero mis intentos han sido en vano, a continuacion muestro el codido (Omiti codigo de javascript que no aporta a mi problema)
Código HTML:
Ver original<?php
include 'JA_Select_Participantes.php';
$enlace=new Personal();
$personal=$enlace->get_personal();
$clientes=$enlace->get_clientes();
?>
<script type="text/javascript" src="js/jquery.validate.js"></script>
<script type="text/javascript"> $(document).ready(function(){
$('#f_asis').validate({
rules: {
}
});
});
<script type="text/javascript"> function validar() {
var lista1 = document.getElementById("listado1").getElementsByTagName("INPUT");
var lista2 = document.getElementById("listado2").getElementsByTagName("INPUT");
fGroup = groupCheck1(lista1);
if (!fGroup)
{
return false;
}
fGroup = groupCheck2(lista2);
if (!fGroup)
{
return false;
}
return true;
}
function groupCheck1(group)
{
selected = false;
for (var i=0; i<group.length; i++)
{
if (group[i].checked)
{
selected = true;
break;
}
}
if (!selected)
{
alert('Seleccione una Casilla.');
return false;
}
return true;
}
function groupCheck2(group)
{
selected = false;
for (var i=0; i<group.length; i++)
{
if (group[i].checked)
{
selected = true;
break;
}
}
if (!selected)
{
alert('Seleccione una Casilla.');
return false;
}
return true;
}
<form name="f_asis" id="f_asis" action="JA_vatos.php" method="post" onSubmit="return validar();">
dd/mm/aaaa
<input type='text' id="TxtFecha" name="TxtFecha" maxlength="10" size="10" class="required" onBlur='fechas(this.value); this.value=borrar' /><br><br>Hora de inicio
<input type='text' id="hora_ini" name="hora_ini" maxlength="5" size="10" class="required" onBlur='get_hora(this.value)' onChange="document.f_asis.hora_fin.value = ''" /> <br><br>Hora de fin
<input type='text' id="hora_fin" name="hora_fin" maxlength="5" size="10" class="required" onBlur='check_hora(this.value)' /> <br><br>Lugar
<textarea id="TxtLugar" name="TxtLugar" cols="20" rows="2" onKeyUp="return maxlong(this)" class="required" ></textarea>
<div id="listado1" style="overflow:auto;height:200px;WIDTH:50%;border:ridge"> <center>Lista del Personal</center>
<table border="1" WIDTH=100%> <?php foreach($personal as $empleados){ ?>
<td><?php echo $empleados['Usuario']; ?></td> <td><?php echo $empleados['Nombre']; ?></td> <td><?php echo $empleados['Apellido_Paterno']; ?></td> <td><?php echo $empleados['Apellido_Materno']; ?></td> <td><?php echo $empleados['Puesto']; ?></td> <td><input type='checkbox' name='<?php echo $empleados['Usuario']; ?>' />
</td> <?php } ?>
<div id="listado2" style="overflow:auto;height:200px;WIDTH:50%;border:ridge"> <center>Lista de los clientes</center>
<table border="1" WIDTH=100%> <?php foreach($clientes as $cliente){ ?>
<td><?php echo $cliente['Usuario']; ?></td> <td><?php echo $cliente['Nombre']; ?></td> <td><input type='checkbox' name='<?php echo $cliente['Usuario']; ?>' />
</td> <?php } ?>
<div id="listado3" style="overflow:auto;height:2px;WIDTH:50%;border:ridge">
<input type="submit" value="Dame un apreton" />
Un saludo desde ya.