Online forms / HTML help needed!

Discussion in 'Community Discussion' started by idrewuk, Jan 24, 2011.

  1. idrewuk, Jan 24, 2011
    Last edited by a moderator: Jan 24, 2011

    idrewuk macrumors member

    idrewuk

    Joined:
    Aug 15, 2008
    #1
    Hi,

    I'm trying to get a little bit of code to work on my site. It's to have a text box prefilled with 'Your email address'. You click, it disappears. You click out, it comes back.

    Hard to explain but hopefully the code will help. It's not showing up for some reason and only works if you click inside the box and back out again. Am I missing something obvious?

    PHP:
    <form action='http://url/form.cgi' method='post'>
    <
    input type='hidden' name='list' value='Form Name'/>
    <
    input type='hidden' name='redirect-success' value='http://www.url.co.uk/complete.html'/>
    <
    br/>
    <
    input type='text' name='email' onfocus="if(this.value=='Your email address')this.value='';this.className='Focus'" onblur="if(this.value=='')this.value='Your email address';this.className='Blur'" class="Blur" /><br/>
    <
    input type='hidden' name='action' value='add'/><input type="image" src="/img/homepage/image.jpg" alt="" class='button' />
    </
    form>
    Does this make sense to anybody? This is all I have to make it work - as far as I know there's no external .js file needed?
     
  2. ergdegdeg Moderator emeritus

    ergdegdeg

    Joined:
    Oct 13, 2007
    #2
    You first have to set the placeholder value of your input field like this:

    PHP:
    <input type="text" value="Your E-Mail address here" />
     
  3. idrewuk thread starter macrumors member

    idrewuk

    Joined:
    Aug 15, 2008
    #3
    Thanks so much, really appreciate it. Live and learn!
     

Share This Page