aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes checkbox Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "checkbox" Watch "checkbox" New topic
Author

checkbox

sejal joshi
Greenhorn

Joined: Dec 19, 2000
Posts: 5
hello
i am doin g a project for opinion polling.i am using servlets & jdbc connections & oracle at backend.on my servlet which generates a html page there r three radio buttons & one submit button
when i click on submit i want to detect which radio button is selected.& calculate
the no of times it is selected.if i am not selecting any option
message should come.pls reply soon.
Sejal

Archu
bill bozeman
Ranch Hand

Joined: Jun 30, 2000
Posts: 1070
I can help out with the javascripting to pop-up the window.
Radio buttons are a little more difficult to check, and sometimes the easiest way to handle these is to set one of them as defaulting to being checked. Then you don't have to do any javascript because one will always be selected.
But if that is not what you wanted, to check for a value, you need to loop through each radio button and check the status of checked. So in the following example, form_name refers to the form and radio_name refers to the radio buttons name.
First loop through the items
for (i=0; i<document.form_name.radio_name; i++)
Then check for the checked value
if (document.form_name.radio_name[i].checked) return true;
Then if you don't return from the function, you know that they didn't select an item and you just pop-up your alert message and return false.
I didn't check the syntax of this, but I think this is correct.
Bill
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: checkbox