Go Back   Rhinocerus > Newsgroup > Newsgroup comp.lang.java.* > Newsgroup comp.lang.javascript

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 12-30-2006, 03:11 PM
Evertjan.
Guest
 
Posts: n/a
Default Re: On select Radio Button / Change Combo box values

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)
Reply With Quote
Alt Today
Advertising
 
and become member of Rhinocerus
Standard Sponsored Links

  #2 (permalink)  
Old 12-31-2006, 06:49 AM
Eric Layman
Guest
 
Posts: n/a
Default 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
Reply With Quote
  #3 (permalink)  
Old 12-31-2006, 11:51 AM
Bart Van der Donck
Guest
 
Posts: n/a
Default Re: On select Radio Button / Change Combo box values

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

Reply With Quote
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Proc Format : Alpha Numeric???? Ian Whitlock Newsgroup comp.soft-sys.sas 0 04-21-2006 07:04 PM
Re: Max tables in PROC SQL toby dunn Newsgroup comp.soft-sys.sas 0 04-14-2006 09:45 PM
Max tables in PROC SQL Ian Whitlock Newsgroup comp.soft-sys.sas 0 04-14-2006 09:01 PM
SAS AF -- radio and combo box mal-function. Robin Newsgroup comp.soft-sys.sas 3 03-17-2006 01:56 PM
Re: Why INPUT function can not change missing values to numerictype? Ian Whitlock Newsgroup comp.soft-sys.sas 0 12-09-2004 03:52 PM



All times are GMT. The time now is 08:58 PM.


Copyright ©2009

LinkBacks Enabled by vBSEO 3.3.0 RC2 © 2009, Crawlability, Inc.