Groups | Blog | Home
all groups > flash (macromedia) > june 2004 >

flash (macromedia) : clearing text field then conditionally checking if info has been inputted


Kee
6/28/2004 4:47:29 PM
now my next question would be.. if that person does not fill in the black
after it has been cleared.. and he clicks elsewhere.. how do i write that
conditional statement to check to see if its blank.. and if so.. then add
back the instructions into the line..

ie..
the 'name' field will say.. "Enter your name Here"
thus when he clicks the field, it clears.. and when he doesnt type in his
name.. the text "Enter your name here" returns back into the field..??

thanks again, I'm sure its something simple.. I just cant find it anywhere
online..


[quoted text, click to view]

Laiverd.COM
6/29/2004 1:58:56 AM
Duh; had expected that question a little earlier ;-) Solution is indeed
simple, just build in a check on the string that is in the textfield:

myInputField.onSetFocus = function(){
if(this.text == "The string that is default in the textfield"){
this.text = "";
}
}

Oops, reading again. The above is an answer to the question I did expect.
Anyway:

myInputField.onKillFocus = function(){
if(this.text == ""){
this.text = "The string that is default in the textfield";
}
}

John

--
----------------------------------------------------------------------------
-----------
RESOURCES
http://groups.google.com/advanced_group_search?hl=en&as_ugroup=*flash
----------------------------------------------------------------------------
-----------
TUTORIALS at
www.laiverd.com
Flash & PHP Emailform
Using textfiles in Flash
----------------------------------------------------------------------------
-----------

Kee
6/29/2004 9:46:18 AM
JOHN, THANKS! I KNEW IT WAS SOMETHING THAT EASY!
and yes.. i would have asked the question sooner.. but i had forgotten
totaly that I even asked on here.. haha
but this forum RULES! THANKS AGAIN!

Kee

[quoted text, click to view]

Laiverd.COM
6/29/2004 6:42:55 PM
<q>but i had forgotten
totaly that I even asked on here</q>

That's what you get from crossposting.

John

--
----------------------------------------------------------------------------
-----------
RESOURCES
http://groups.google.com/advanced_group_search?hl=en&as_ugroup=*flash
----------------------------------------------------------------------------
-----------
TUTORIALS at
www.laiverd.com
Flash & PHP Emailform
Using textfiles in Flash
----------------------------------------------------------------------------
-----------

AddThis Social Bookmark Button