Meaningless Drivel is fun!*
The moose likes HTML, CSS and JavaScript and the fly likes help with radio buttons Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "help with radio buttons" Watch "help with radio buttons" New topic
Author

help with radio buttons

kevin comario
Ranch Hand

Joined: Jun 29, 2002
Posts: 65
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?
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Look in my sig
Eric
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61105
    
  66

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


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
kevin comario
Ranch Hand

Joined: Jun 29, 2002
Posts: 65
Thanks for the help! i did not know about the checked attribute. That makes everything clear.
 
Consider Paul's rocket mass heater.
 
subject: help with radio buttons