# Input text fields - Initial values problem

**URL:** <https://forum.kirupa.com/t/input-text-fields-initial-values-problem/226709>\
**Category:** flash\
**Created:** [May 23, 2007, 11:55am UTC](https://forum.kirupa.com/t/input-text-fields-initial-values-problem/226709 "2007-05-23T11:55:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![revlis](https://avatars.discourse-cdn.com/v4/letter/r/3da27b/32.png) [@revlis](https://forum.kirupa.com/u/revlis)\
**Post date:** [May 23, 2007, 11:55am UTC](https://forum.kirupa.com/t/input-text-fields-initial-values-problem/226709/1 "2007-05-23T11:55:10Z")

</div>

Hi, I have a search box with an intial text value “Search here…” inside the input box. When the user clicks inside the box “Search here…” will disappear. This is the code I use (thanks to claudios previous post):

```auto
searchBox.border = true;
searchBox.borderColor = 0x737373;

fields = [searchBox];//your textfields instance names
captions = ["Search..."];//default text for each textfield
for (var i in fields) {
    this.fields*.j = this.i;
    this.fields*.text = captions*;
    this.fields*.onSetFocus = function() {
        if (this.text == captions[this.j]) {
            this.text = "";
        }
    };
    this.fields*.onKillFocus = function() {
        if (!this.length) {
            this.text = captions[this.j];
        }
    };
}

```

It works great except when I click in the box the initial text disappears like it should but when you click outside the box again without entering any text the “Search here…” appears and they quickly disappears. Any ideas why it disappears quickly after?
