By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,529 Members | 1,860 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,529 IT Pros & Developers. It's quick & easy.

Textbox when radio button clicked

P: n/a
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
Jul 23 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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>
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 23 '05 #2

P: n/a
On 13 Jun 2004 17:15:54 GMT, "Evertjan."
<ex**************@interxnl.net> wrote:

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
Jul 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.