• 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
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

help with radio buttons  RSS feed

 
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a few groups of radio buttons that I need to evaluate using JavaScript before i submit it to another page using the GET method in my code.
the question I have is that my radio buttons are initally unchecked how do i go about evaluating my form to find out if the client checked one of my radio buttons.
here is my code so far:

Could i possibly just have a lot of small forms for each individual group of radio buttons?
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look in my sig
Eric
 
Sheriff
Posts: 67260
170
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Unlike most other form elments, the reference to the radio buttons by name evaluates to a collection rather than a single element.
So in your page document.pro1.classes references a collection of the radio elements named 'classes'. You can loop through this collection looking for which one has a 'checked' attribute set to true.
hth,
bear
 
kevin comario
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the help! i did not know about the checked attribute. That makes everything clear.
 
My pie came with a little toothpic holding up this tiny ad:
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!