• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

accessing Array of radiobutton array

 
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's not an answer but why to give them such names ? Removing the brackets would solve the problem
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try this:


[ September 07, 2006: Message edited by: jaikiran pai ]
 
Jaikiran Pai
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic