AS3 :
function irAEnviar(event:MouseEvent):void {
var misVariables:URLVariables = new URLVariables();
misVariables.nombre = txtNombre.text;
misVariables.apellidos = txtApellidos.text;
misVariables.email = txtEmail.text;
var pedido:URLRequest = new URLRequest();
pedido.url = "http://www.tuDominio.com/correo/enviarCorreo.php";
pedido.method = URLRequestMethod.POST;
pedido.data = misVariables;
var cargador:URLLoader = new URLLoader();
cargador.dataFormat = URLLoaderDataFormat.VARIABLES;
cargador.addEventListener(Event.COMPLETE, completeHandler);
try {
cargador.load(pedido);
} catch (error:Error) {
lbError.text= "Error en el envío";
}
function completeHandler(event:Event):void {
lbRespuesta.text=event.target.data.respuestaPHP;
}
}
btEnviar.addEventListener(MouseEvent.CLICK, irAEnviar);
Mi problema es que me manda el mensaje del formulario, sin que yo aya puesto algo en los campos de texto. Como hago para crear una condicion que no me permita mandar el mensaje sin antes haber completado todos los campos de textos?.
Gracias de antemano.
