473,657 Members | 2,407 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Radio button selection in jsp

58 New Member
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 11301
JosAH
11,448 Recognized Expert MVP
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 Recognized Expert Top Contributor
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">M ale
<input type="radio" name="gender">F emale
<input type="submit" value="submit">
</form>
[/HTML]

good luck
Jun 14 '07 #3
shanmukhi
58 New Member
give them the same name:
[HTML]
<form name="form1">
<input type="radio" name="gender">M ale
<input type="radio" name="gender">F emale
<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
18564
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 button, without any event handling, and it works fine. However, in Case 2, which is what I am trying to do, it has the problem that even when the user clicks the button, it won't show the value automatically. But wait until user selects another...
1
6314
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 google. The 3rd option I want to search the site using MS-Index Server. I can get them to run individually but I'm not sure how to set the parameters and test for the 3rd radio button (index server) selected on the page. I thought that, for...
2
12337
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 ... without having to get this value via html, is there any way I can passed the checked value via html .. maybe with syntax like n4.checked.value or something.. Many thanks. <html>
6
3281
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 The problem i am facing is that i do not know how many yes/no radio groups will be generated
2
2889
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. <tr><td><input type="radio" name="item_name" value="Reduced">Reduced</td><td><input type="radio" name="amount" value="25">$25.00ea.</td></tr> <tr><td><input type="radio" name="item_name" value="Regular">Regular</td><td><input type="radio"...
1
2401
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 program is, ./exe Please enter the selections( displays 1to 6 options) if either of them selected the program starts.
3
2308
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 choice question, in our case it's 'Accept', 'Not Accept' or 'Pending' in a grid column. There are multple rows in the grid maybe 2, 3 or even 10 rows and we want to make it so that the user, when they select 'Accept' in say the second row that the...
2
5887
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 the form by changing the visible state of the radio buttons and labels utilising back and next buttons. E.g. Next button makes current radio buttons and labels invisible and
10
3404
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 selection from select list. Initially I tried to disble the selection control. And when user will click the radio then only it was enabled. but I faced problem that value is not passed to the next form of the select list. so I enable the select list now...
0
8323
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8838
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8513
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7351
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4173
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4329
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2740
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1969
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1732
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.