File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes radio buttons selection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "radio buttons selection" Watch "radio buttons selection" New topic

radio buttons selection

alex pandiyan

Joined: Aug 25, 2004
Posts: 10
Hi all,
I have 4 radio buttons in my jsp page.
The first one should be selected while it is loaded.
So,am using the below code:
<input type="radio" name="radio1" value="first" checked>
The user should be able to select only one radio button.
How to do this in jsp?
<input type="radio" name="radio2" value="second">
<input type="radio" name="radio3" value="third">
<input type="radio" name="radio4" value="fourth">

If i try the above code,all radio buttons get selected.
I need the user to select any one radio button only.
Just plain jsp code is needed.
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63544

This is purely an HTML question. Moving to the HTML/Javascript forum.

[Asking smart questions] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63544

For the radio buttons to be considered a 'radio group' they must all have the same name.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: radio buttons selection
It's not a secret anymore!