Contact Form - field names
Hi,
I have here a nice contact form. The only problem I got is that I would like to have the field names (name, e-mail, telephone), displayed inside the right field, (so when the user clicks inside, the text would disappear automatically) in stead of displaying the names next to the fields.
My first tough was to write inside each field, in flash the field names, and it was ok for the first look. But the user needs to delete first the field names like "name" from the input box, in order to enter his own.
How could I make these field names automatically dissapear when the user clicks inside a text box?
the code:
stop();
send_btn.addEventListener(MouseEvent.CLICK, submit);
function submit(e:MouseEvent):void
{
var variables:URLVariables = new URLVariables();
variables.fromname = name_txt.text;
variables.fromtel = tel_txt.text;
variables.fromemail = email_txt.text;
variables.frommessage = message_txt.text;
var req:URLRequest = new URLRequest("contact.php");
req.data = variables;
req.method = URLRequestMethod.POST;
var loader:URLLoader = new URLLoader();
loader.dataFormat = URLLoaderDataFormat.VARIABLES;
loader.addEventListener(Event.COMPLETE, sent);
loader.addEventListener(IOErrorEvent.IO_ERROR, error);
loader.load(req);
status_txt.text = "Sending...";
}
function sent(e:Event):void
{
status_txt.text = "Message Sent.";
name_txt.text = "";
tel_txt.text = "";
email_txt.text = "";
message_txt.text = "";
}
function error(e:IOErrorEvent):void
{
status_txt.text = "Error. Please try lather.";
}
Thanks!!
ved