Ver Mensaje Individual
  #1  
Antiguo 23-09-2016
uper uper is offline
Miembro
 
Registrado: abr 2004
Posts: 296
Reputación: 21
uper Va por buen camino
validar formulario con jquery elemento especifico

buenso dias, como puedo validar un formulario que especifique un elemento en especifico con jquery, ya que resulta que debo de validar checkbox que son de tipo array, asi como textbox, este es codigo y agrege una funcion pero esta me valida a todos los checkbox cuando cada array checkbox determino si se debe validar o no, hay forma de que se especifique:
Código PHP:
<html>
    <
head>
        <
link type="text/css" href="css/headermain.css" rel="stylesheet" />                
        <
script type="text/javascript" src="js/jquery-1.9.1.js"></script>        
        <script type="text/javascript" src="js/funcion.js"></script>
    </head>
    <body>        
        <br>
        <h2>Clientes</h2>        
        <form name="busca" method="POST" enctype="multipart/form-data">
            <br>            
            CLIENTE: 
                <input type="text" name="cliente" id="cliente" maxlength="50" style="width:440px;height:25px;"/>
              </span></div>
            <br>
            
            <br>
             asignacion: <input type="text" name="asignacion" id="asignacion" size="40" value="">
    <br>
            
            <table>
                       <td style="width:18px;height:20px;">L</td>
                       <td style="width:18px;height:20px;">M</td>
                       <td style="width:18px;height:20px;">M</td>
                       <td style="width:18px;height:20px;">J</td>
                       <td style="width:18x;height:20px;">V</td> 
        </table>
                dia revision
                       <input type="checkbox" name="drevision[]" class="form-input" style="width:20px;height:20px;" value="1"/>
                       <input type="checkbox" name="drevision[]" class="form-input" style="width:20px;height:20px;" value="2"/>
                       <input type="checkbox" name="drevision[]" class="form-input" style="width:20px;height:20px;" value="3"/>
                       <input type="checkbox" name="drevision[]" class="form-input" style="width:20px;height:20px;" value="4"/>
                       <input type="checkbox" name="drevision[]" class="form-input" style="width:20px;height:20px;" value="5"/>
    <br>
    dia pago
                       <input type="checkbox" name="dpago[]" class="form-input" style="width:20px;height:20px;" value="1"/>
                       <input type="checkbox" name="dpago[]" class="form-input" style="width:20px;height:20px;" value="2"/>
                       <input type="checkbox" name="dpago[]" class="form-input" style="width:20px;height:20px;" value="3"/>
                       <input type="checkbox" name="dpago[]" class="form-input" style="width:20px;height:20px;" value="4"/>
                       <input type="checkbox" name="dpago[]" class="form-input" style="width:20px;height:20px;" value="5"/>
                       
        <input class="form-btn" name="submit" type="submit" value="Guardar " />
        </form>        
        
    </body>
</html> 

--funcion.js
$(document).ready(function(){
 
   $("#boton1").click(function(event){
       //alert("presionats");
        var selected = ''; 
       
        $('#formid input[type=checkbox]').each(function(){               
            if (this.checked) {
                selected += $(this).val()+', ';
            }
        }); 
        
        if (selected != '') {
            alert('Has seleccionado: ' + selected);
            return true;
        }
        else {
            alert('Al menos seleccina un elemento');
            return false;
        }
 });
}); 
se los agradesco, posteo la captura , gracias
Responder Con Cita