473,804 Members | 3,250 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2978
Bart Verbeke wrote on 13 jun 2004 in comp.lang.javas cript:
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(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)
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(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>


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
3285
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 issue then the textarea box is filled in. Is there a way to do this? I am not an expert in Javascript so please treat me as stupid!
1
1339
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 code, it is not reflected in the asp:textbox control. The control still shows a blank asp:textbox. The radio button is of type <input type="radio"> and not asp:RadioButton. I
11
4257
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. How I stop the buttons from posting back when they are clicked? Thanks
1
3502
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 know how. With links I found it it would work like this: <SCRIPT LANGUAGE="JavaScript"> function click(which) {
1
3019
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: (RADIO BUTTON) djs: (RADIO BUTTON) hfjd: Can anyone please help me.. Thanks
2
10097
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 another radio button is selected, then the 1st textbox should disappear and should display in front of the new radio button selected. Following is my code: <html> <head> <script type="text/javascript">
2
3663
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 click on any of the rb in the column and from that click derive the contents of the textbox next to it that it is "linked" to.
5
15155
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
2384
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
9708
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9588
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10085
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9161
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7625
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5527
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4302
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3828
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2999
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.