Hi all, I put some initial values in a form field to help the user, i use php to extract the form data and send it via email. How do i get the initial value in the text field to stop appearing in the email. example, I have a name tag Town and the initial value I have shown that I want in that form field is Town. You can delete the initial value and then type the Town name, but i don't want users to have to do this.
I get Town name tag supplied but I also get
"Town: TownInverness" supplied by email, how do i stop the initial value been collected?
does this make sense?
thanks

Okay, maybe I'm going about this wrong, If I just have the user filling in the form by telling them to delete the initial value before they type would this be a better way of doing this? That way I collect only the new value or text they put in the box with my php script. If they have javascript turned off, this I understand will also affect the browser by not deleting the value when they click in the box.
Is this the better thing to do?

Hi..
According to what you have written in your post, i'll suggest you to use Javascript for this purpose..
When someone clicks on the text box, the initial value in it gets empty (town in this case), and then the new value entered by the user will appear in the email.. See the code attached

Hope this helps..

<script language="javascript" type="text/javascript">
function when_obj_blur(frmObject,frmValue)
{
  if(frmObject.value=="")
      frmObject.value=frmValue;
}
</script>

<input type="text" name="Town" value="Town" onfocus="javascript:this.value='';" onblur="javascript:when_obj_blur(this,'Town')">
This article has been dead for over six months. Start a new discussion instead.