Ver Mensaje Individual
  #1 (permalink)  
Antiguo 25/01/2005, 15:51
phg
 
Fecha de Ingreso: agosto-2004
Mensajes: 18
Antigüedad: 19 años, 7 meses
Puntos: 0
Formulario valida campos solo una vez

Tengo un problema señores del foro a ver si alguien me ayuda:

Cuando entro al formulario flash y quiero enviarlo sin llenar algun campo, este me devuelve un mensage "DATO NECESARIO", luego pongo "BORRAR", luego ingreso el solo el mail y ENVIAR, (AQUI EL ERROR)se envia sin los demas datos; osea que validad solo la primera vez luego te envia los campos asi esten vacios, quisiera que alguien me ayude talves falta algo en el codigo:

Codigo flash:
enviar = function () {
if (email_txt.text.length && nombre_txt.length && telefonos_txt.length && direccion_txt.length && titulo_txt.length && mensaje_txt.length) {
if (email_txt.text.indexOf("@") != -1 && email_txt.text.indexOf(".") != -1) {
form_lv = new LoadVars();
form_lv.nombre = nombre_txt.text;
form_lv.telefonos = telefonos_txt.text;
form_lv.direccion = direccion_txt.text;
form_lv.mail = email_txt.text;
form_lv.mensaje = mensaje_txt.text;
form_lv.titulo = titulo_txt.text;
form_lv.sendAndLoad("send.php", form_lv, "POST");
mensaje_txt.text = "Enviando Mensaje..";
nombre_txt.text = "";
telefonos_txt.text = " ";
direccion_txt.text = " ";
email_txt.text = "";
titulo_txt.text = "";
form_lv.onLoad = function() {
if (this.estatus == "ok") {
mensaje_txt.text = "Mensaje enviado.";
nombre_txt.text = "";
telefonos_txt.text = " ";
direccion_txt.text = " ";
email_txt.text = "";
titulo_txt.text = "";
} else {
mensaje_txt.text = "Problemas con el servidor\nIntentalo de Nuevo";
}
};
} else {
email_txt.text = "Correo Invalido";
}
} else {
email_txt.text = "Dato Necesario";
nombre_txt.text = "Dato Necesario";
telefonos_txt.text = "Dato Necesario";
direccion_txt.text = "Dato Necesario";
titulo_txt.text = "Dato Necesario";
mensaje_txt.text = "Dato Necesario";
}
};

if (email_txt.text.length && nombre_txt.length && telefonos_txt.length && direccion_txt.length && titulo_txt.length && mensaje_txt.length)

if (email_txt.text.indexOf("@") != -1 && email_txt.text.indexOf(".") != -1) {

form_lv_lv = new LoadVars();
form_lv.nombre = nombre_txt.text;
form_lv.telefonos = telefonos_txt.text;
form_lv.direccion = direccion_txt.text;
form_lv.mail = email_txt.text;
form_lv.mensaje = mensaje_txt.text;
form_lv.titulo = titulo_txt.text;
form_lv.sendAndLoad("send.php", form_lv, "POST");
mensaje_txt.text = "Enviando Mensaje..";
}

form_lv.onLoad = function() {
if (this.estatus == "ok") {
mensaje_txt.text = "Mensaje enviado.";
nombre_txt.text = " ";
telefonos_txt.text = " ";
direccion_txt.text = " ";
email_txt.text = " ";
titulo_txt.text = " ";
} else {
mensaje_txt.text = "Problemas con el servidor\nIntentalo de Nuevo";
}
};

borrar = function () {
nombre_txt.text = " ";
telefonos_txt.text = " ";
direccion_txt.text = " ";
email_txt.text = " ";
mensaje_txt.text = " ";
titulo_txt.text = " ";
};

enviar_btn.onRelease = enviar;
borrar_btn.onRelease = borrar;

Codigo php:

<?php
if(isset($_POST["nombre"]) && isset($_POST["titulo"]) && isset($_POST["telefonos"]) && isset($_POST["direccion"]) && isset($_POST["mail"]) && isset($_POST["mensaje"]) ){
$fecha = date("d/m/y H:i a");
$mymail = "[email protected]";
$subject = "Formulario web";
$contenido = "Nombre: " . $_POST["nombre"]."\n";
$contenido .= "Empresa: " . $_POST["titulo"]."\n";
$contenido .= "Teléfonos: " . $_POST["telefonos"]."\n";
$contenido .= "Dirección: " . $_POST["direccion"]."\n";
$contenido .= "---------------------------\n";
$contenido .= "Consultas y/o Cotizaciones:\n";
$contenido .= "---------------------------\n";
$contenido .= $_POST["mensaje"]."\n\n";
$contenido .= "---------------------------\n";
$contenido .= "Enviado >> ".$fecha;
$header = "From:".$_POST["mail"]."\nReply-To:".$_POST["mail"]."\n";
$header .= "X-Mailer:PHP/".phpversion()."\n";
$header .= "Mime-Version: 1.0\n";
$header .= "Content-Type: text/plain";
mail($mymail, $subject, $contenido ,$header);
echo "&estatus=ok&";
}
?>


Sera que me falta algo en el codigo, prueben y ayudenme..........

Saludos
|phg|

Última edición por phg; 25/01/2005 a las 16:30