• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

dynamic determining the length of radio buttons

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,


case 1.

<input type=radio name=r value=1 >1 </input>
<input type=radio name=r value=2 >2 </input>

if i display a alert for length of radio using r.length
In this case 1. the value i get through the alert is 2
-------------------------------------------------------
case 2.

<input type=radio name=r value=1 >1 </input>

if i display a alert for length of radio using r.length
In the case 2. the value i get through the alert is undefined

----------------------------------------------------

Through some logic i am creating the radio buttons dynamically at runtime. the problem i am facing is i don't know how many buttons will be displayed.
If the no of radio buttons are more than one case 1. works fine.

If the no of radio buttons is equal to exactly one or no radio buttons found, how would i get the length.

ie. i am facing problem with case 2.

Thanks in advance.
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This explains the problem:
http://www.felgall.com/jstip2a.htm
 
Chandra S Marappa
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks
 
Ever since I found this suit I've felt strange new needs. And a tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic