Ver Mensaje Individual
  #1 (permalink)  
Antiguo 14/09/2012, 15:46
ruud
 
Fecha de Ingreso: septiembre-2012
Mensajes: 17
Antigüedad: 11 años, 8 meses
Puntos: 0
aviso en formulario

quiera saber que codigo agregar para cuando introdusca un email correcto, me desaparesca el aviso que dice "Introduce un mail correcto".

codigo del php es :
Código PHP:
Ver original
  1. <?php
  2. $nombre = $_POST["nombre"];
  3. $telefono = $_POST["telefono"];
  4. $mail = $_POST["mail"];
  5.  
  6. $mensaje  = "Nombre:     " . $_POST['nombre'] . "\n";
  7. $mensaje .= "Telefono:    " . $_POST['telefono']  . "\n";
  8. $mensaje .= "Mail:          " . $_POST['mail']     . "\n\n";
  9. $mensaje .= "Mensaje:    " . $_POST['mensaje'] . "\n\n";
  10.  
  11. $cabecera = "From: $nombre <$mail> \r\n";
  12. $cabecera .= "Reply-To: $mail";
  13.  
  14. if(mail("[email protected]", "Formulario desde el Sitio", $mensaje, $cabecera)){
  15.     echo "estado=Su mensaje FUE Enviado";
  16. }
  17. else{
  18.     echo "estado=Su mensaje NO fue enviado";
  19. }
  20. ?>

el as3
Código ASP:
Ver original
  1. var misVariables:URLVariables = new URLVariables();
  2. var cargador:URLLoader = new URLLoader();
  3. var pedido:URLRequest = new URLRequest();
  4.  
  5.  
  6. pedido.url = "http://www.prueva/forma.php";
  7. pedido.method = URLRequestMethod.POST;
  8. pedido.data = misVariables;
  9. cargador.dataFormat = URLLoaderDataFormat.VARIABLES;
  10.  
  11. btn_enviar.addEventListener(MouseEvent.CLICK, enviar);
  12. cargador.addEventListener(Event.COMPLETE, cargaCompleta);
  13.  
  14. function enviar(event:MouseEvent)
  15. {
  16.     if(mail_txt.text.indexOf("@") == -1 || mail_txt.text.indexOf(".") == -1)
  17.     {
  18.         aviso_txt.text = "Introduce un mail correcto";
  19.     }
  20.     else
  21.     {
  22.         enviarFormulario();
  23.     }
  24. }
  25.  
  26. function enviarFormulario()
  27. {
  28.     misVariables.nombre = nombre_txt.text;
  29.     misVariables.telefono = telefono_txt.text;
  30.     misVariables.mail = mail_txt.text;
  31.     misVariables.mensaje = mensaje_txt.text;
  32.    
  33.     try
  34.     {
  35.         cargador.load(pedido);
  36.     }
  37.     catch (error:Error)
  38.     {
  39.         trace ("Error en el envío"+error);
  40.     }
  41. }
  42.  
  43. function cargaCompleta(event:Event):void
  44. {
  45.     nombre_txt.text = "";
  46.     telefono_txt.text = "";
  47.     mail_txt.text = "";
  48.     mensaje_txt.text = "";
  49.    
  50.     gotoAndStop(10);
  51. }
  52.  
  53. stop();
Código ASP:
Ver original
  1. telefono_txt.restrict = "0-9";
  2.  
  3. nombre_txt.tabIndex = 1;
  4. telefono_txt.tabIndex = 2;
  5. mail_txt.tabIndex = 3;
  6. mensaje_txt.tabIndex = 4;
  7. btn_enviar.tabIndex = 5;
Código ASP:
Ver original
  1. aviso_txt.text = cargador.data.estado;

Última edición por ruud; 14/09/2012 a las 15:56