Ver Mensaje Individual
  #1 (permalink)  
Antiguo 06/05/2012, 11:20
netxea
 
Fecha de Ingreso: mayo-2012
Mensajes: 1
Antigüedad: 12 años
Puntos: 0
validacion checkbox

Buenas!
He visto varios mensajes del foro referidos a la validación de checkboxes, pero sigo sin lograr hacer lo que quiero.
Tengo un formulario en el que inserto dos textbox y luego debo elegir 1 elemento de la lista. No logro saber cual he elegido.

Este es el código del formulario:

<form name="Formu" method="post">
<br>
<table border=1 class="textos" width=30% style="position:absolute; top:220px; left:50px; color:#1A0ACC; border-color: b0d4e3">
<tr>
<td width=15% style="padding:3px">
NOMBRE EQUIPO
</td>
<td width=30% style="padding:3px">
<input type=text name="nombreEquipo" value= "" size=30 maxlength=20>
</td>
</tr>
<tr>
<td width=15% style="padding:3px">
TEMPORADA
</td>
<td width=30% style="padding:3px">
<input type=text name="temporada" value= "" size=10 maxlength=10>
</td>
</tr>
</table>

<table border=2 width=50% style="position:absolute; top:300px; left:50px; color:#1A0ACC; border-color: b0d4e3">
<tr>
<td class="textos" width=10% style="padding:3px">
<center>CODIGO</center>
</td>
<td class="textos" width=25% style="padding:3px">
<center>NOMBRE CATEGORIA</center>
</td>
<td class="textos" width=30% style="padding:3px">
<center>NOMBRE SUBCATEGORIA</center>
</td>
<td class="textos" width=15% style="padding:3px">
<center>EDAD MINIMA</center>
</td>
<td class="textos" width=15% style="padding:3px">
<center>EDAD MAXIMA</center>
</td>
<td class="textos" width=10% style="padding:3px">
<center>SELECCIONAR</center>
</td>
</tr>

<?php

$indice = 0;
While ($indice < $filasCategoria)
{
$codigoCategoria = mysql_result($resultadoCategoria, $indice, "codigoCategoria");
$nombreCategoria = mysql_result($resultadoCategoria, $indice, "nombreCategoria");
$nombreSubcategoria = mysql_result($resultadoCategoria, $indice, "nombreSubcategoria");
$edadMinima = mysql_result($resultadoCategoria, $indice, "edadMinima");
$edadMaxima = mysql_result($resultadoCategoria, $indice, "edadMaxima");

echo "<tr><td class=\"detalle\" width=10% style=padding:3px><center>$codigoCategoria</center></td>";
echo "<td class=\"detalle\" width=15% style=padding:3px>$nombreCategoria</td>";
echo "<td class=\"detalle\" width=25% style=padding:3px>$nombreSubcategoria</td>";
echo "<td class=\"detalle\" width=15% style=padding:3px><center>$edadMinima</center></td>";
echo "<td class=\"detalle\" width=15% style=padding:3px><center>$edadMaxima</center></td>";
?>
<td>
<center><input type ="checkbox" name="categoriaSeleccionada"></center>
</td>
</tr>

<?php

$indice++;
}

?>

</table>

<table border=0 width=40% style="position:absolute; top:140px; left:350px">
<tr>
<td>
<center><input type=button class="boton" value='MENÚ PRINCIPAL' onClick="Elegir(<?php echo $esAdministrador; ?>)"><center>
</td>
<td>
<center><input type=button class="boton" value='FIN DATOS BÁSICOS' onClick="Contar()"><center>
</td>
</tr>
</table>
</form>

Y este el de las funciones javascript:
function Contar()
{
var checkboxes = document.getElementById("Formu").checkbox;
var cont = 0;
for (var x=0; x < checkboxes.length; x++)
{
if (checkboxes[x].checked)
{
cont = cont + 1;
}
}

if(cont==0)
{
alert('Lo siento. Debes seleccionar una categoría.');
}
else
{
AltaEquipoAnyo();
}
}

function AltaEquipoAnyo()
{
document.Formu.action = "MenuUsuario.php";
document.Formu.submit();
}

Agradecería pudiesen echarme una mano por favor.