Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

accessing Array of radiobutton array

 
Nishita Jain
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's not an answer but why to give them such names ? Removing the brackets would solve the problem
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this:


[ September 07, 2006: Message edited by: jaikiran pai ]
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use the form element array.

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

Eric
 
Nishita Jain
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic