Ver Mensaje Individual
  #1 (permalink)  
Antiguo 22/01/2013, 14:46
Avatar de DRANIX
DRANIX
 
Fecha de Ingreso: abril-2010
Mensajes: 24
Antigüedad: 14 años, 1 mes
Puntos: 1
Pregunta Enviar Formulario Con Un checkbox Jquery

Hola Amigos.

tengo un pequeño problema al tratar de enviar unos formularios,
bueno tengo tres formularios cada uno tiene un checkbox y la idea es que al seleccionar uno de los tres y presionar el boton se envie el formulario correspondiente. hasta ahorita sigo atorado con eso. he estado leyendo algunos temas del foro pero no consigo dar con la solucion.. me imagino que podria funcionar con la la funcion $(this), pero no se como implementarlo.

les pongo mi codigo para que lo chequen, es lo que tengo hasta ahorita
desde ya gracias.

Código PHP:
<!DOCTYPE html>
<
html>
    <
head>
        <
title>Ejemplo</title>
        <
script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js" type="text/javascript"></script>
        <script>
        $(document).ready(function(){
            $("#Enviando").click(function(){
                if($('input[type=checkbox]').is(':checked')){                
                    $("#formulario").submit();
                    $("input[type=checkbox]").prop('checked', false);
                }else{
                    alert('Selecciona Un Archivo');
                    return false;
                }
            });    
        });
        </script>
    </head>
    <body>
    <!-- Boton Que Enviara El Formulario Seleccionado -->
        <input type="button" id="Enviando" value="Enviar">
        <br>
        <table>
        <tr>
            <td>
                <input type="checkbox" name="form1">
            </td>
            <td><!-- Formulario 1 -->
                <form id="formulario" action="prueba.php" method="POST">
                <input type="text" name="cliente" value="Checando">
                </form>
            </td>
        </tr>
        <tr>
            <td>
                <input type="checkbox" name="form2"> 
            </td>
            <td><!-- Formulario 2 -->
                <form class="formulario" action="prueba2.php" method="POST">
                <input type="text" name="cliente2" value="Checando2">
                </form>
            </td>
        </tr>
        <tr>
            <td>
                <input type="checkbox" name="form3">
            </td>
            <td><!-- Formulario 3 -->
                <form class="formulario" action="prueba3.php" method="POST">
                <input type="text" name="cliente3" value="Checando3">
                </form>
            </td>
        </tr>
    </body>    
</html>