473,396 Members | 1,767 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,396 software developers and data experts.

On select Radio Button / Change Combo box values

Hi,

I have a radio button and a combo box.

Upon changing a value for radio button, the combo box values will be
dynamically updated.

I have an idea on how to go abt doing it but Im stuck into converting into
code.

Eg: I will have 3 arrays. arr1, arr2, arr3.

Each array contains the values that is to be in the combo box.

I have 3 radio buttons. r1,r2,r3

I have one combo box, combo1.

Upon clicking r1, combo1's option value will be changed to values of arr1,
etc etc

Please advise. Thanks

Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
Dec 30 '06 #1
2 12410
Eric Layman wrote on 31 dec 2006 in comp.lang.javascript:
I have a radio button and a combo box.
"A combo box is a user interface control GUI element. It is a combination
of a drop-down list or list box and a single-line textbox, allowing the
user to either: 1) type a value directly into the control; or 2) choose
from the list of existing options."
<http://en.wikipedia.org/wiki/Combo_box>

That does not exist in HTML, but probably you mean a drop-down list.
Upon changing a value for radio button, the combo box values will be
dynamically updated.

I have an idea on how to go abt doing it but Im stuck into converting
into code.
Well, show your code sofar.
Eg: I will have 3 arrays. arr1, arr2, arr3.
Each array contains the values that is to be in the combo box.
I have 3 radio buttons. r1,r2,r3
I have one combo box, combo1.

Upon clicking r1, combo1's option value will be changed to values of
arr1, etc etc

Please advise. Thanks
It seems you want us to do the javascript coding?
Perhaps you better hire a professional programmer?

Better start programming yourself, this will educate nxt to the getting
of the desired result.

Some help perhaps:

You could start leaving the idea of the arrays and
just build 3 different drop-down lists, of which only one is displayed at
a time, the other two are CSS-display:none;-ed by the radio button
settings.

This will prevent the need of complex DOM child adding and removing.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Dec 30 '06 #2
Eric Layman wrote:
I have a radio button and a combo box.
Upon changing a value for radio button, the combo box values will be
dynamically updated.
I have an idea on how to go abt doing it but Im stuck into converting into
code.
Eg: I will have 3 arrays. arr1, arr2, arr3.
Each array contains the values that is to be in the combo box.
I have 3 radio buttons. r1,r2,r3
I have one combo box, combo1.
Upon clicking r1, combo1's option value will be changed to values of arr1,
etc etc
var cars = new Array('Audi','BMW','Ford','Opel','Toyota');
var days = new Array('Monday','Wednesday','Friday');
var jobs = new Array('engineer','salesman');

document.write('<form>'
+'<input type="radio" name="r" value="r1" onClick="p1(cars)">cars'
+'<input type="radio" name="r" value="r2" onClick="p1(days)">days'
+'<input type="radio" name="r" value="r3" onClick="p1(jobs)">jobs'
+'<hr><select size="1" name="combo1" style="width:150px">'
+'<option value="">choose radio</option>'
+'</select>'+'</form>');

var co = document.forms[0].combo1;

function p1(nC) {
while (co.options.length) co.options[0] = null;
for (var i = 0; i < nC.length; i++)
co.options[co.length] = new Option(nC[i], nC[i]);
}

Hope this helps,

--
Bart

Dec 31 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: David | last post by:
Hi, May I know how to create data dynamically in a combo box after clicking on a radio button ? Data are retrieved using a store procedure from a SQL Server. For example : Click Radio Button...
14
by: Steve Chatham | last post by:
I have a combo box that gets populated with a group of items based on a sql table. I had in mind that I'd insert a value at the beginning of that combo box, that'd say "No Item Selected" and...
2
by: NishSF | last post by:
Would anyone have any suggestions/javascript code so that if one clicks the Radio Button "Yes" below he has the option of selecting any of the six CheckBox below. If the user clicks on Radio Button...
1
by: amitsaxena | last post by:
hi , i m using asp.net2.0 with c# ,i m using server side radio buttons and i want to use ajax tecnology on radio button change event so plese describe the process .I also using AJAX DLL so...
2
by: sejal17 | last post by:
hello I want to select radio button with the database value. i have three radio button: <input type='radio' name='method' value='Paypal' checked='check'>Paypal <input type='radio'...
3
by: kiranbabu | last post by:
<html> <head> <h2 align=center>Blank Tapes Status Form</h2> <br><title>Blank tapes status</title> </head> <body> <br><br> <form name=tapes_status method=post>
2
by: genkidave | last post by:
Hi there, I have three combo boxes that I would like to have Disabled (grayed out???) and preselected to a particular selection until a radio button (YES) is clicked, thus enabling the combo...
1
by: Izzy123 | last post by:
how do we auto selected a radio button when the user enters a numeric value in a textbox? my code for radio button and text box are as follows: <li>Do you like your membership priviledge? ...
1
by: BaseballGraphs | last post by:
Hello, I was hoping someone could provide or suggest a resource where I may be able to see implementation of the following programming situation. I would like to create a simple radio button...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...
0
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,...

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.