473,410 Members | 1,875 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,410 software developers and data experts.

Radio button selection in jsp

Hi All,

how to control the selection of radio buttons in jsp.
i think i have to write java script for that..
my code is like this
Expand|Select|Wrap|Line Numbers
  1. <form name="form1">
  2. <input type="radio" name="male">Male
  3. <input type="radio" name="female">Female
  4. <input type="submit" value="submit">
  5. </form>
  6.  
my problem is
if i select one radio button then i am not able to deselect it and
i am not able to select only one radio button.
how can i achieve it by using java script.

can anybody help me?
Jun 14 '07 #1
3 11223
JosAH
11,448 Expert 8TB
Hi All,

how to control the selection of radio buttons in jsp.
i think i have to write java script for that..
my code is like this
Expand|Select|Wrap|Line Numbers
  1. <form name="form1">
  2. <input type="radio" name="male">Male
  3. <input type="radio" name="female">Female
  4. <input type="submit" value="submit">
  5. </form>
  6.  
my problem is
if i select one radio button then i am not able to deselect it and
i am not able to select only one radio button.
how can i achieve it by using java script.

can anybody help me?
I thought that default behaviour is that you can only deselect a radio button by
selecting another radio button. If I remember well you can preselect a radio
button using the "selected" flag in it's tag.

You don't need Javascript for that; simply make your JSP generate the
appropriate html and you're in bizniz ;-)

kind regards,

Jos
Jun 14 '07 #2
epots9
1,351 Expert 1GB
Hi All,

how to control the selection of radio buttons in jsp.
i think i have to write java script for that..
my code is like this
Expand|Select|Wrap|Line Numbers
  1. <form name="form1">
  2. <input type="radio" name="male">Male
  3. <input type="radio" name="female">Female
  4. <input type="submit" value="submit">
  5. </form>
  6.  
my problem is
if i select one radio button then i am not able to deselect it and
i am not able to select only one radio button.
how can i achieve it by using java script.

can anybody help me?
give them the same name:
[HTML]
<form name="form1">
<input type="radio" name="gender">Male
<input type="radio" name="gender">Female
<input type="submit" value="submit">
</form>
[/HTML]

good luck
Jun 14 '07 #3
give them the same name:
[HTML]
<form name="form1">
<input type="radio" name="gender">Male
<input type="radio" name="gender">Female
<input type="submit" value="submit">
</form>
[/HTML]

good luck
it's working fine now..
thank u
Jun 15 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Matt | last post by:
I have radio buttons on a form, and when the user makes the selection, it will trigger the event and send the form to the web server and print the selected value. In Case 1, I just use submit...
1
by: Brian | last post by:
Hello all... I have a page that will be performing a search. The search consists of 3 radio button options. The first 2 will search the entire web through google and the site as indexed by...
2
by: jason | last post by:
The following (likely far from imperfect code), reports a value of NaN in the j4 display. I suppose the problem is I am not really passing the "checked" value of the radio button via .value ......
6
by: Craig Keightley | last post by:
I have a page that has n number of radio groups (yes/No) how can i prevent the form being submitted if more than one radio group is not selected? By default all radio groups are unchecked ...
2
by: Stoic | last post by:
I'm offering a selection of three items. One is $25, the second is $50, the third is $100. Along with selection one of the items I need to pass the quantity of the selection. Here is the code now....
1
by: Para | last post by:
Hi , I am working on a project using C/C++ in linux environment. Our program right now using the command line(console window) inputs and starts executing. command on console are to start...
3
by: Chris Marsh | last post by:
Hello, Is it possible w/ASP.Net to set the property of the radio button control to 'read-only' after the user has made their selection before hitting an 'submit' button? Think of a multiple...
2
by: dpazza | last post by:
Hi, I'm creating a quiz on using a form in VB 2005 express. I have four sets of questions and answers (labels and radio buttons) and I change between which set of questions is currently shown on...
10
by: mukeshrasm | last post by:
Hi I have a html in which there is two selection box and two radio button. Radio buttion is of array type. What I want if user will click the radio button then only he/she be able to make...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.