Textbox when radio button clicked

Discussion in 'Javascript' started by Bart Verbeke, Jun 13, 2004.

  1. Bart Verbeke

    Bart Verbeke Guest

    Hi,

    I have a form with 2 radio buttons (ACCEPT/REJECT). When the page is
    initially loaded, no textbox should be visible.

    When a user clicks the REJECT radio button, a textbox should
    automatically appear below the radiobutton where the user can motivate
    why he chose the reject option (which we require).

    When the user clicks the ACCEPT radio button, the textbox should not
    appear because we don't need motivations for accept actions.

    Does someone have a clue if and how I can realize this in JavaScript?

    Thanks,
    Bart
     
    Bart Verbeke, Jun 13, 2004
    #1
    1. Advertisements

  2. Bart Verbeke

    Evertjan. Guest

    Bart Verbeke wrote on 13 jun 2004 in comp.lang.javascript:
    Alsjeblieft:

    <input type='radio' name='aacrej' value='acc'
    onclick="doen(this)" checked> Accepteren
    <br>
    <input type='radio' name='aacrej' value='rej'
    onclick="doen(this)"> Rejecteren
    <br>
    <input id='motief' name='motief'
    style='visibility:hidden;'>

    <script type='text/javascript'>
    function doen(x){
    document.getElementById('motief').style.visibility=
    (x.value=='acc')?'hidden':'visible'
    }
    </script>
     
    Evertjan., Jun 13, 2004
    #2
    1. Advertisements

  3. Bart Verbeke

    Bart Verbeke Guest

    dankjewel!

    Groetjes,
    Bart
     
    Bart Verbeke, Jun 14, 2004
    #3
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.