Textbox when radio button clicked

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bart Verbeke

    Textbox when radio button clicked

    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
  • Evertjan.

    #2
    Re: Textbox when radio button clicked

    Bart Verbeke wrote on 13 jun 2004 in comp.lang.javas cript:
    [color=blue]
    > 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?[/color]

    Alsjeblieft:

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

    <script type='text/javascript'>
    function doen(x){
    document.getEle mentById('motie f').style.visib ility=
    (x.value=='acc' )?'hidden':'vis ible'
    }
    </script>


    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)

    Comment

    • Bart Verbeke

      #3
      Re: Textbox when radio button clicked

      On 13 Jun 2004 17:15:54 GMT, "Evertjan."
      <exjxw.hannivoo rt@interxnl.net > wrote:
      [color=blue]
      >
      >Alsjeblieft:
      >
      ><input type='radio' name='aacrej' value='acc'
      > onclick="doen(t his)" checked> Accepteren
      ><br>
      ><input type='radio' name='aacrej' value='rej'
      > onclick="doen(t his)"> Rejecteren
      ><br>
      ><input id='motief' name='motief'
      > style='visibili ty:hidden;'>
      >
      ><script type='text/javascript'>
      >function doen(x){
      > document.getEle mentById('motie f').style.visib ility=
      > (x.value=='acc' )?'hidden':'vis ible'
      >}
      ></script>[/color]

      dankjewel!

      Groetjes,
      Bart

      Comment

      Working...