473,321 Members | 1,916 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,321 software developers and data experts.

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
Jul 23 '05 #1
2 2927
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Claire Osborne | last post by:
I have created a form at http://www.habitatforhumanity.org.uk/html/gv_indiv_apply.htm In the Medical Details section we need to ensure that if a radio button is clicked to indicate a health...
1
by: sarj | last post by:
Hi.... I have a asp:textbox whose text needs to be set when a radio button is clicked. The text would correspond to the value of the particular. However, although the text is correctly set in...
11
by: bill | last post by:
I dynamically create buttons and associate them with an event using AddHandler. I want all the button events to fire at one time, when the page is posted, instead of when each button is clicked....
1
by: namanhvu | last post by:
Hi everyone, I'm trying to create a form where the radio button is automatically selected when the input text field beside it is clicked. I know I need to use "onClick" somewhere but I don't...
1
by: jw01 | last post by:
Im trying to write a java script in HTML in which when a particular radio button is selected, a textbox would appear write next to the selected item. e.g (RADIO BUTTON) fhd: (RADIO BUTTON) fdj:...
2
by: jw01 | last post by:
I changed my code...Now everytime i click a radio button, a text box appears...What i want is when i hit a particular radio button, the textbox should only appear next to that radio button. And if...
2
by: Peted | last post by:
I have 6 radio buttons in a column with a single line text box next to each rb. is there a general straightforward way to link a radio button to the textbox next to it. I want to be able to...
5
by: Kulgan | last post by:
Hi all, Is it possible in javascript to add a textbox when the last of three radiobuttons is clicked ? thanks !
4
by: januincse | last post by:
There 2 radio buttons.when a radio is clicked textbox should appear,when another radio clicked the existing textbox should disappear and new textbox should be enabled.
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.