Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Apr 2005
    Posts
    53
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Conditional form textarea

    Hi!

    Forgive me if this has already been answered. I couldn't find any reference to it.

    I have an existing form built in ASP. 3 questions have drop-downs with the option of "other". If someone chooses "other", I want them to fill in a text area. However; if they do not chose "other", I don't want then to see the text area or at the very least, be able to fill in the text area. How can I use javascript to make it conditional in this manner?

    Please be gentle as I am a newbie with the javascripting.

    Thanks in advance,
    Anessa

  • #2
    Senior Coder
    Join Date
    Mar 2005
    Location
    Portsmouth UK
    Posts
    4,517
    Thanks
    3
    Thanked 506 Times in 493 Posts
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
    
    <html>
    
    <head>
      <title></title>
    </head>
    
    <body>
    <select onchange="document.getElementById('fred').style.visibility=(this.selectedIndex==2)?'visible':'hidden';" >
    <option>Option 0</option>
    <option>Option 1</option>
    <option>Option 2</option>
    </select>
    <textarea id="fred" rows="2" cols="50" style="visibility:hidden;" ></textarea>
    </body>
    
    </html>
    Vic

    God Loves You and will never love you less.

    http://www.vicsjavascripts.org/Home.htm

    If my post has been useful please donate to http://www.operationsmile.org.uk/

  • #3
    New Coder
    Join Date
    Apr 2005
    Posts
    53
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Smile

    Thats it! Thank you so much!!


  •  

    Posting Permissions

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