Form Question

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • albumin40
    Sergeant Major

    • Aug 2007
    • 94

    Form Question

    Hi
    When building a form and adding a comments box I know it can be prepopulated with text.

    Is it possible when the user clicks on this text that it is all highlighted and thus the user can begin typing right away?

    I know that this is a very small point (probably nitpicking !) and that all the user has to do is simply delete the text.

    Can it be done?

    Thanks

    Colin (www.miscarriage-ni.org.uk)
  • judavvforum
    Major

    • Nov 2007
    • 384

    #2
    Re: Form Question

    Someone could probably do it with "scripts", but would cost you! Most computer users wouldn't expect that they could do that anyway. So, try this, (if the text doesn't matter to you): Type in this text: "Your comment box message,(Ctrl-click here to type)"They will point at the text at the end, hold Ctrl key and click. This will select all and delete the initial text when they start typing. At least it does in my XP/IE!

    Comment

    • Watdaflip
      Major General

      • Sep 2005
      • 2116

      #3
      Re: Form Question

      Try adding code inside the html of the textbox
      Code:
      onFocus="if(this.value=='Replace this with the exact default text that is shown in the text box')this.value='';"
      When you look at the html it should look something like this:
      Code:
      <textarea id="bv_" name="something" onFocus="if(this.value=='[COLOR=Red]Your default text[/COLOR]')this.value='';">[COLOR=Red]Your default text[/COLOR]</textarea>
      The red text in the code box above should match exactly

      Register/Login Script
      Do you use a Password Protected Directory? Need a way to allow users to make their own account, try my .htaccess Login Script

      Comment

      • albumin40
        Sergeant Major

        • Aug 2007
        • 94

        #4
        Re: Form Question

        Thanks guys. Very much appreciated !

        Sincerely

        Colin

        Comment

        Working...
        X