View Full Version : Prefilled Textbox Validation - Please Help

02-04-2008, 09:16 PM
I have a form with prefilled textboxes (has an initial value and gets cleared when focus is set on that textbox). I used the below code to get it done -

<input type="text" value="Name" onfocus="if (this.value == 'Name') { this.value=''; }" onblur="if (this.value == '') { this.value='Name'; }" />

Now i need to validate this textbox - no numbers/special chars, i should accept it only if there is a change made to the name (or new one entered). If it is still 'Name' it should display a message (alert) saying 'please enter name' - how to i get this done. Please help.

Thanks a lot.