Foros del Web » Programando para Internet » Javascript » Frameworks JS »

cambiar etiqueta button por hipervinculo para validacion de formulario

Estas en el tema de cambiar etiqueta button por hipervinculo para validacion de formulario en el foro de Frameworks JS en Foros del Web. @import url("http://static.forosdelweb.com/clientscript/vbulletin_css/geshi.css"); Código Javascript : Ver original <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> <title>jQuery validation plug-in - main demo</title> <link rel="stylesheet" type="text/css" media="screen" href="../../../web/css/jquery-ui.css" ...
  #1 (permalink)  
Antiguo 15/09/2011, 21:00
 
Fecha de Ingreso: marzo-2009
Mensajes: 356
Antigüedad: 15 años, 1 mes
Puntos: 7
cambiar etiqueta button por hipervinculo para validacion de formulario

Código Javascript:
Ver original
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
  4. <title>jQuery validation plug-in - main demo</title>
  5. <link rel="stylesheet" type="text/css" media="screen" href="../../../web/css/jquery-ui.css" />
  6. <script src="../lib/jquery.js" type="text/javascript"></script>
  7. <script src="../jquery.validate.js" type="text/javascript"></script>
  8.  
  9. <script type="text/javascript">
  10. $.validator.setDefaults({
  11.     submitHandler: function() { alert("submitted!"); },
  12.     highlight: function(input) {
  13.         $(input).addClass("ui-state-highlight");
  14.     },
  15.     unhighlight: function(input) {
  16.         $(input).removeClass("ui-state-highlight");
  17.     }
  18. });
  19.  
  20. $().ready(function() {
  21.     // validate the comment form when it is submitted
  22.     $("#commentForm").validate();
  23.    
  24.     // validate signup form on keyup and submit
  25.     $("#signupForm").validate({
  26.         rules: {
  27.             firstname: "required",
  28.             lastname: "required",
  29.             username: {
  30.                 required: true,
  31.                 minlength: 2
  32.             },
  33.             password: {
  34.                 required: true,
  35.                 minlength: 5
  36.             },
  37.             confirm_password: {
  38.                 required: true,
  39.                 minlength: 5,
  40.                 equalTo: "#password"
  41.             },
  42.             email: {
  43.                 required: true,
  44.                 email: true
  45.             },
  46.             topic: {
  47.                 required: "#newsletter:checked",
  48.                 minlength: 2
  49.             },
  50.             agree: "required",
  51.                         newsletter: "required"
  52.         },
  53.         messages: {
  54.             firstname: "Please enter your firstname",
  55.             lastname: "Please enter your lastname",
  56.             username: {
  57.                 required: "Please enter a username",
  58.                 minlength: "Your username must consist of at least 2 characters"
  59.             },
  60.             password: {
  61.                 required: "Please provide a password",
  62.                 minlength: "Your password must be at least 5 characters long"
  63.             },
  64.             confirm_password: {
  65.                 required: "Please provide a password",
  66.                 minlength: "Your password must be at least 5 characters long",
  67.                 equalTo: "Please enter the same password as above"
  68.             },
  69.             email: "Please enter a valid email address",
  70.             agree: "Please accept our policy",
  71.                         newsletter: "ingresa tu new"
  72.         }
  73.     });
  74.    
  75.    
  76. });
  77. </script>
  78. </head>
  79. <body>
  80.  
  81. <form class="cmxform" id="signupForm" method="get" action="a.php">
  82.     <fieldset class="ui-widget ui-widget-content ui-corner-all">
  83.         <legend class="ui-widget ui-widget-header ui-corner-all">Validating a complete form</legend>
  84.         <p>
  85.             <label for="firstname">Firstname</label>
  86.             <input id="firstname" name="firstname" />
  87.         </p>
  88.         <p>
  89.             <label for="lastname">Lastname</label>
  90.             <input id="lastname" name="lastname" />
  91.         </p>
  92.         <p>
  93.             <label for="username">Username</label>
  94.             <input id="username" name="username" />
  95.         </p>
  96.         <p>
  97.             <label for="password">Password</label>
  98.             <input id="password" name="password" type="password" />
  99.         </p>
  100.         <p>
  101.             <label for="confirm_password">Confirm password</label>
  102.             <input id="confirm_password" name="confirm_password" type="password" />
  103.         </p>
  104.         <p>
  105.             <label for="email">Email</label>
  106.             <input id="email" name="email" />
  107.         </p>
  108.         <p>
  109.             <label for="agree">Please agree to our policy</label>
  110.             <input type="checkbox" class="checkbox" id="agree" name="agree" />
  111.         </p>
  112.         <p>
  113.             <label for="newsletter">I'd like to receive the newsletter</label>
  114.             <input type="checkbox" class="checkbox" id="newsletter" name="newsletter" />
  115.         </p>
  116.         <p>
  117.             <button class="submit" type="submit">Submit</button>
  118.         </p>
  119.     </fieldset>
  120. </form>
  121.  
  122. </body>
  123. </html>

hay todo funciona normal con el button type submit, pero yo lo malo es que yo no uso button si no hipervinculo

<a href="javascript: document.adminForm.action='../ruta'; document.adminForm.submit()" >
Guardar
</a>


como hago para cambiar el button por hipervinculo ??

esa es mi duda

gracias

Etiquetas: etiqueta, hipervinculo, html, javascript, jquery, js, php, formulario
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 11:41.