SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member
    Join Date
    Jul 2009
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Show/Hide Values in Input Text Box

    I have several input text boxes. The default value for the boxes is the description of the contents of the box. When the user clicks on the box to type, the default values disappear so they can begin typing.

    My problem is what if the user forgets what the contents of the box is suppose to be. I am looking for a solution where if the input box is empty, and the user deselects it, the original default value will appear.


    Code:
    <input type="text" value="Event Name" onfocus="value=''" />

  2. #2
    SitePoint Enthusiast
    Join Date
    Nov 2010
    Location
    Largo
    Posts
    67
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Without Java I wouldnt know how to make the text re appear

    but what about adding a ? with a false link and a title so when the question mark is hovered the info will pop up

    <input type="text" value="Event Name" onfocus="value=''" /><a href=" " title="what the user needs to remember">?</a>
    Memory For Server

    SELECT * FROM `US`.`Politics` WHERE `Idiocracy` = '0';
    MySQL returned an empty result set ( Query took 0.0005 sec )

  3. #3
    SitePoint Member
    Join Date
    Jul 2009
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That false ? is a pretty good idea. I will use that as my last resort. My goal is to keep the site as clean as possible, which is why I opted to describe the purpose of each text field within itself.

  4. #4
    SitePoint Enthusiast
    Join Date
    Jul 2011
    Location
    New Delhi
    Posts
    28
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    We usually use a dynamic page for forms utilizing some sort of programming language. Using Ajax with Asp.net will achieve what you want easily.

  5. #5
    SitePoint Enthusiast Adam Chrapkowski's Avatar
    Join Date
    Sep 2011
    Location
    Poland
    Posts
    42
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I suggest to use some jQuery plugin such like http://www.aakashweb.com/jquery-plugins/textbox-hinter/, if I remember well it works for both textarea and text input.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •