Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

default text replaced with user entered info.

Anonymous
Not applicable
I have searched all over to see how this is done. I found one other response to this question, but it was not complete.



Basically what I am wondering is, how do I set up my text field so that there is a default text to signify what the user should type into the box. When the user clicks the text field, this default is removed so they can begin typing.



Thank you!
5 Replies
pguerett
Level 10
Level 10
You can enter your default text into the field by loading it in Designer, highlighting the field and entering the text you want into the Deafult area under the Object/Value palette. Now in the script editor under the Enter event you can add this javascript code:



this.rawValue = "";



Be aware that if the user goes back into that field at a later time then the value they previously entered will disappear as well.



A more better way woudl be to see if the field value was the same as the dafault and if it was then clear it. Assuming the default text was "Please enter data here!", you could write javacript code like something like this:



if (this.rawValue == "Please enter data here!"){

this.rawValue = "";

}



With this technique you will not overwrite anything they previously entered.



Make sense?
tltagami
Level 4
Level 4

I'm a newbie at this and not very experienced with Javascript. I tried to add this code to the script editor for a field, but I am getting a script error. I made sure the default language was Java in Properties. Could you please expand this step by step with everything I need to put in the editor box?

Thanks!

pguerett
Level 10
Level 10

It woudl be easier to see hwat you have done and suggest ways of correcting it.

Also coudl you expand on what you are trying to do?

Paul

tltagami
Level 4
Level 4

Actually, just after I posted this, I figured it out. But thank you for the speedy reply!

Anonymous
Not applicable
Thank you so incredibly much! You really, really helped me!!!!!!!!!!!! It worked perfectly.