# onFocus function is clearing my variable! Help?

**URL:** <https://forum.kirupa.com/t/onfocus-function-is-clearing-my-variable-help/221288>\
**Category:** flash\
**Created:** [April 3, 2007, 4:36am UTC](https://forum.kirupa.com/t/onfocus-function-is-clearing-my-variable-help/221288 "2007-04-03T04:36:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Head\_In\_A\_Pan](https://avatars.discourse-cdn.com/v4/letter/h/c67d28/32.png) [@Head\_In\_A\_Pan](https://forum.kirupa.com/u/Head_In_A_Pan)\
**Post date:** [April 3, 2007, 4:36am UTC](https://forum.kirupa.com/t/onfocus-function-is-clearing-my-variable-help/221288/1 "2007-04-03T04:36:49Z")

</div>

Hello!

I’m cool with posting to PHP - but decided to have an initial message in my textInput to instruct people to input their email address.

But now that the onFocus function is telling the textInput it equals “” when clicked, it is posting the variable as “” instead of what the user has input!!

How do I clear my textInput for the user but still post the user’s info?

The onFocus code is:

```auto

this.email_address.text = " your@email.com";
tiListener = new Object();
tiListener.onSetFocus = function () {
    email_address.text = "";
    };
Selection.addListener(tiListener);

```

And my posting code is:

```auto

var email_address:mx.controls.TextInput;
var tiListener:Object = new Object();
tiListener.handleEvent = function (evt_obj:Object){
 if (evt_obj.type == "enter"){
  if (email_address.length < 1) {
   trace("You must enter at least 1 character");
  } else {
   trace("Thanks");
  }
 }
}
email_address.addEventListener("enter", tiListener);

btn_submit.onRelease = function() {

    var mailingList:LoadVars = new LoadVars();
   
    var email:LoadVars = new LoadVars();
    
    email.email_address = email_address.text;

//Post data        

    email.sendAndLoad("mailingList.php", mailingList, "POST");    
    
};

```
