473,325 Members | 2,771 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,325 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 11208
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: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.