aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes accessing Array of radiobutton array Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "accessing Array of radiobutton array" Watch "accessing Array of radiobutton array" New topic
Author

accessing Array of radiobutton array

Nishita Jain
Ranch Hand

Joined: Mar 30, 2006
Posts: 97
hi all,
i just want to know how to access Array of radiobutton array
here is the code..
input type=radiobutton name=radio1
input type=radiobutton name=radio1
input type=radiobutton name=radio1
if this is code then i can get value of checkbox in js as radio1[0]
document.form.radio1[0].value
radio1[1]
radio1[2]
and this thing is working fine...
but when the name is like radio[1] i mean,
input type=radiobutton name=radio[1]
input type=radiobutton name=radio[1]
input type=radiobutton name=radio[1]
and i try to access like
document.form.radio[1][0].value

it gives me error...
May i know the answer..
Thanks i advance,
Nishita


Nishita
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

It's not an answer but why to give them such names ? Removing the brackets would solve the problem


[My Blog]
All roads lead to JavaRanch
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10052
    
163

Try this:


[ September 07, 2006: Message edited by: jaikiran pai ]

[My Blog] [JavaRanch Journal]
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10052
    
163

However, as already mentioned by Satou kurinosuke, i would try to keep the name simple, instead of creating complexities of this sort.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Use the form element array.

document.forms[0].elements["radio[1]"][1]

Eric
Nishita Jain
Ranch Hand

Joined: Mar 30, 2006
Posts: 97
hello all,

Thanks very much for replying..both the things are working.
and ya this names are really mandatory... because i was using struts indexedProperties and it was generating names like that only..

thanks for great help...

Nishita
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: accessing Array of radiobutton array