Ver Mensaje Individual
  #6 (permalink)  
Antiguo 20/04/2012, 12:28
Avatar de emprear
emprear
Colaborador
 
Fecha de Ingreso: junio-2007
Ubicación: me mudé
Mensajes: 8.388
Antigüedad: 16 años, 10 meses
Puntos: 1567
Respuesta: Validar formulario y evitar envio

Te dejo una nuestra muy básica (y con muchas deficiencias, ya que deberías analizar si lo que se ingresa es un numero, si el campo no esta vacio, etc) de como es el proceso básico de validación

Código HTML:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <title>titulo</title>
  5. <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  6.  
  7. <script type="text/javascript">
  8. //<![CDATA[
  9. function validar(){
  10. var valor = document.getElementById('numero').value;
  11. valor = parseInt(valor);
  12. if(valor <= 5){
  13. alert('Error, el numero debe ser mayor que 5');
  14. return false;
  15. }
  16. }
  17. //]]>
  18. </head>
  19. <form action="x.php" onsubmit="return validar();">
  20. <input type="text" id="numero" value="" />
  21. <input type="submit" value="procesar" />
  22. </form>
  23. </body>
  24. </html>

Si decís que sabés php no te será tan fácil de implementar
Para el resto, un poco de Google y manuales (http://librosweb.es)

Saludos
__________________
La voz de las antenas va, sustituyendo a Dios.
Cuando finalice la mutación, nueva edad media habrá
S.R.