W3C home > Mailing lists > Public > www-dom@w3.org > January to March 2006

Radio button group

From: Waters, Tyler S FOR:EX <Tyler.Waters@gov.bc.ca>
Date: Thu, 16 Mar 2006 16:51:54 -0800
Message-ID: <75288380B55B044BB95108574F19D0231B71BD@hill.idir.bcgov>
To: <www-dom@w3.org>

Hi.

I'm curious if I'm missing something when it comes to using
..getElementById on radio buttons. 

Say I have a series of radio buttons. 
Since I want the user to select only one, they all need to have the same
name, let's say 'radioname'....  If they have different names, the user
can select more than one.

Now ideally, I would like to call document.getElementById('radioname')
and have an array of radio button elements returned, but instead all I
get is the first one. 
I am forced into using 
document.formname.elements.radioname[0], 
document.formname.elements.radioname[1], 
document.formname.elements.radioname[2] etc. 

I think this is a major shortfall with the DOM... so close to being the
best, yet so far away when it comes to radio buttons..   
Unless of course I'm missing something... Am I ?

Thanks

Tyler Waters
Auxiliary Web Analyst
Ministry of Forests and Range
Revenue Branch
mailto:Tyler.Waters@gov.bc.ca
Received on Saturday, 18 March 2006 13:37:32 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:13:58 GMT