Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting rid of text

Status
Not open for further replies.

MrPantsTm

Programmer
Jan 22, 2004
71
US
It seems when the users of some forms enter in data they neglect to erase the info in the form to begin with (e.g 'Type your Name here' never gets erased.) So when they submit it that info gets put in the database as well as the info I need.

My question, is there any way to remove those comments I have in the textarea before it is submitted or do I need to use another parsing language to extract those lines (if so I'll post this question in that forum)? Thanks a lot.
 
Well, you could use javascript, but if the user has javascript disabled you'll still end copying the 'Please type' to the db.

The solution is to parse it.

<marc> i wonder what will happen if i press this...[ul][li]please tell us if our suggestion has helped[/li][li]need some help? faq581-3339[/li][/ul]
 
Sure...

Code:
<input type="text" name="firstname" value="First name here" onfocus="if (this.value='First name here') this.value=''">

The same kind of trick will work for textareas etc.

Jeff
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top