Adding Text To A Form Field?

Discussion in 'HTML & Website Design' started by Custard, Jan 24, 2007.

  1. #1
    Hi,

    I need to add some text to a form field so the user can click the field to start filling it in, and then the text disappears.

    Can anybody advise me on exactly how to achieve this?

    Many thanks.
     
    Custard, Jan 24, 2007 IP
  2. unitedrokz

    unitedrokz Peon

    Messages:
    86
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    #2
    you need to insert a function in your html code which will do what you are after....

    add this in your field code:

    onClick="this.value=''"

    that will reset the field and make it empty when clicked on


    so for example, a text field would look like this

    <INPUT TYPE="text" NAME="text_field" SIZE=50 VALUE="Fill in this text field! " onClick="this.value=''">
     
    unitedrokz, Jan 24, 2007 IP
  3. Valve-Hosting

    Valve-Hosting Peon

    Messages:
    1,071
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Erm, or just look in the properties box at the bottom of dreamweaver with the form selected.
     
    Valve-Hosting, Jan 26, 2007 IP
  4. rgchris

    rgchris Peon

    Messages:
    187
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Or, if you're not using a WYSIWYG editor just do something like this:

    <input type = "text" name = "textbox" value = "Click to fill out">
    Code (markup):
    The click to fill out will disappear once the user clicks on the box.
     
    rgchris, Jan 29, 2007 IP
  5. unitedrokz

    unitedrokz Peon

    Messages:
    86
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    #5
    it will? have you tested that?

    as far as i know you need the onclick command to tell it do disappear
     
    unitedrokz, Jan 29, 2007 IP
  6. oliverbowen

    oliverbowen Well-Known Member

    Messages:
    326
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    110
    #6
    I would have to agree with unitedrokz that works on my computer perfectly.

    Thanks dude, helpful little tip.

    Oliver
     
    oliverbowen, Jan 29, 2007 IP