buscando por la web no consigo encontrar la solucion, por eso pido ayuda, necesito validar un grupo de checkbox que se genera para cada fila de una tabla, lo que necesito es que se pueda seleccionar un check solo si el de la fila anterior se selecciono primero, es decir por ejemplo que de un error si quiero seleccionar el check de la fila 3, sin antes seleccionar el de la fila 2, esta es la tabla donde se generan los check:
<table class="table table-striped table-bordered table-hover dataTable">
<thead>
<tr> <!-- encabezado de tabla -->
<td colspan="4" bgcolor="#58acfa">
<p style="color:#ffffff";><strong>TODAS LAS CUOTAS</strong></p>
</td>
</tr>
<tr>
<th><center>Cuotas</center></th>
<th><center>Importe</center></th>
<th><center>Fecha de Vencimiento</center></th>
<th style="width: 20%;"><center>PAGAR</center></th>
</tr>
</thead>
<tbody>
<?php
if (count($cuentas) > 0) {
if (is_array($cuentas)) {
foreach ($cuentas as $cuenta):
?>
<tr>
<td style="font-family: 'Open Sans', sans-serif;"><center><?php echo element('cuotas', $cuenta); ?></center></td>
<td style="font-family: 'Open Sans', sans-serif;"><center><?php echo element('importe', $cuenta); ?></center></td>
<?php $fechaVencimiento = element('fechaVencimiento', $cuenta); ?>
<td style="font-family: 'Open Sans', sans-serif;"><center><?php echo $fechaVencimiento;?></center></td>
<td>
<center>
<input type="checkbox">
</center>
</td>
</tr>
<?php
endforeach;
}
}
?>
</tbody>
</table>