Textbox when radio button clicked

B

Bart Verbeke

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
 
E

Evertjan.

Bart Verbeke wrote on 13 jun 2004 in comp.lang.javascript:
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?

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>
 
B

Bart Verbeke

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>

dankjewel!

Groetjes,
Bart
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top