473,569 Members | 2,402 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Select all radio buttons

5 New Member
Hi,

i m new in javascript. i have the below problem. Plz help.

There are two main radio buttons and list of radio button under each one . On selecting of the first radio button a list of radio buttons under it must be selected . And on selecting the other radio button the list of radio buttons must be cleared under the first one and the list under the second must be selected.
Jun 27 '07 #1
12 10474
acoder
16,027 Recognized Expert Moderator MVP
Welcome to TSDN!

Show some code, e.g. at least your HTML.

You can't select all radio buttons, only one, unless that's not what you meant.
Jun 27 '07 #2
Ashvini Shanbhag
5 New Member
[HTML]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitl ed Document</title>
</head>

<body>
<form name="frm" style="display: inline ">
<table width="100%" border="0" cellpadding="0" cellspacing="1" class="Calendar Content" id="user1_platf orm1" style="display: inline">
<tr>
<td align="center" nowrap class="tblHeade r">Approve deactivation
<table border="0" cellpadding="0" cellspacing="2" >
<tr>
<td><input name="rdoApp1" type="radio" class="RADIO" value="radiobut ton" onClick="aprvAl l(3, this.name)"></td>
<td class="contentT ext">Approve All </td>
<td><input name="rdoApp1" type="radio" class="RADIO" value="radiobut ton" onClick="aprvAl l(3, this.name)"></td>
<td class="contentT ext">Reject All </td>
</tr>
</table></td>
</tr>
<tr class="tableCel lOff">
<td align="center" class="TableTex t"><input name="rdoApp1_1 " type="radio" class="RADIO" value="yes">
Yes
<input name="rdoApp1_1 " type="radio" class="RADIO" value="radiobut ton">
No </td>
</tr>
<tr class="tableCel lOff2">
<td align="center" class="TableTex t"><input name="rdoApp1_2 " type="radio" class="RADIO" value="radiobut ton">
Yes
<input name="rdoApp1_2 " type="radio" class="RADIO" value="radiobut ton">
No </td>
</tr>
<tr class="tableCel lOff2">
<td align="center" class="TableTex t"><input name="rdoApp1_3 " type="radio" class="RADIO" value="radiobut ton">
Yes
<input name="rdoApp1_3 " type="radio" class="RADIO" value="radiobut ton">
No </td>
</tr>
</table>
</form>
</body>
</html>[/HTML]
Please post code using code tags - MODERATOR
Jun 28 '07 #3
acoder
16,027 Recognized Expert Moderator MVP
Oh, I see now what you mean.

Use the checked property. To access the radio button, either use the form elements array or use document.getEle mentById after giving your radio buttons ids.
Jun 28 '07 #4
KishoreM
12 New Member
Hi,

i m new in javascript. i have the below problem. Plz help.

There are two main radio buttons and list of radio button under each one . On selecting of the first radio button a list of radio buttons under it must be selected . And on selecting the other radio button the list of radio buttons must be cleared under the first one and the list under the second must be selected.
Hi,

Here I have written a sample code hop it will be useful for you if you have any more probs plez revert to me.

regards,

Kishore M
[HTML]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitl ed Document</title>
<script>

function doAll(count,sho wObj,hideObjNam e)
{
if(showObj.chec ked == true)
{
document.getEle mentById(hideOb jName).checked= false;

for(i=1;i <=count;i++)
{
document.getEle mentById(showOb j.name+"_"+i).c hecked=true;
document.getEle mentById(hideOb jName+"_"+i).ch ecked=false;

}
}

}


</script>
</head>

<body>
<form name="frm" style="display: inline ">
<table width="100%" border="0" cellpadding="0" cellspacing="1" class="Calendar Content" id="user1_platf orm1" style="display: inline">
<tr>
<td align="center" nowrap class="tblHeade r">Approve deactivation
<table border="0" cellpadding="0" cellspacing="2" >
<tr>
<td><input name="rdoApp1" type="radio" value="radiobut ton" class="RADIO" onClick="doAll( 3,this,'rdoRej1 ')"></td>
<td class="contentT ext">Approve All </td>
<td><input name="rdoRej1" type="radio" value="radiobut ton" class="RADIO" onClick="doAll( 3,this,'rdoApp1 ')"></td>
<td class="contentT ext">Reject All </td>
</tr>
</table></td>
</tr>
<tr class="tableCel lOff">
<td align="center" class="TableTex t"><input name="rdoApp1_1 " id=="rdoApp1_1" type="radio" class="RADIO" value="radiobut ton">
Yes
<input name="rdoRej1_1 " id=="rdoRej1_1" type="radio" class="RADIO" value="radiobut ton">
No </td>
</tr>
<tr class="tableCel lOff2">
<td align="center" class="TableTex t"><input name="rdoApp1_2 " id=="rdoApp1_2" type="radio" class="RADIO" value="radiobut ton">
Yes
<input name="rdoRej1_2 " id=="rdoRej1_2" type="radio" class="RADIO" value="radiobut ton">
No </td>
</tr>
<tr class="tableCel lOff2">
<td align="center" class="TableTex t"><input name="rdoApp1_3 " id=="rdoApp1_3" type="radio" class="RADIO" value="radiobut ton">
Yes
<input name="rdoRej1_3 " id=="rdoRej1_3" type="radio" class="RADIO" value="radiobut ton">
No </td>
</tr>
</table>
</form>
</body>
</html>

[/HTML]
Jun 28 '07 #5
Ashvini Shanbhag
5 New Member
thanx acoder and kishore....
the code works properly.
thank u very much.
Jun 28 '07 #6
acoder
16,027 Recognized Expert Moderator MVP
Hi,

Here I have written a sample code hop it will be useful for you if you have any more probs plez revert to me.

regards,

Kishore M
For some reason, you have id== instead of id= for all the radio buttons.
Jun 28 '07 #7
Ashvini Shanbhag
5 New Member
there's one prblm... when we selected "yes" or "no" radio button individualy, then only one of the two should be selected.
Jun 28 '07 #8
acoder
16,027 Recognized Expert Moderator MVP
That's because they should have the same name to be radio buttons. Change the names of the 'No' radio buttons back to how you had it before.
Jun 28 '07 #9
Ashvini Shanbhag
5 New Member
i added a new function to the individual "yes" and "no" buttons. now it's working.
and by changing the id names,,it won't work.
But can't we add in the same function.
Jun 28 '07 #10

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

Similar topics

12
6522
by: Kevin Lyons | last post by:
Hello, I am trying to get my select options (courses) passed correctly from the following URL: http://www.dslextreme.com/users/kevinlyons/selectBoxes.html I am having difficulty getting the courses to pass the correct option value and then be displayed at the following URL: http://www.dslextreme.com/users/kevinlyons/selectResults.html ...
1
1779
by: Verner Vaz | last post by:
Select Email ID based on 'a' selected radio button Hello there, I have a simple form with some fields to be filled in and when submitted is emailed to a couple of email ID. Now, this form has 10 radio buttons of which only one can be selected at any time.
4
7385
by: bobsawyer | last post by:
I've been building a series of SELECT lists that are populated dynamically using HTTPRequest. Things are going pretty well, and I've got the whole thing working flawlessly in Mozilla/Firebird. Unfortunately, Internet Explorer doesn't quite work as expected -- it gives me an "invalid argument" error that I don't know how to fix. Here's the...
3
2648
by: larry | last post by:
Hi, I am a newbie to Internet programming. I have some questions about spacing in HTML control names and subsequently being able to access these input elements in JavaScript If you don't have time to read the whole message, the main question is can HTML form names have spaces in them and if so what is the syntax for accessing them using...
1
2966
by: Joe Attardi | last post by:
Hi all, On a form on one of my pages I have two <select> elements, and each one is paired up with a radio button. The idea is to choose an item from one list or the other and select the radio button of the list you want to use. I'm using JavaScript to automatically select the radio button corresponding to a list when you click on the...
4
3375
by: joseff | last post by:
Hi evryone!! I' m very new not only to Python and Tkinter but to programing. I'm a bit stuck here and would be grateful for some help. I have 3 radio select buttons(see below) which I want to link to a pmw dialog with (apply and cancel options ) i.e. when I press enable btn dialog pops up and asks to confirm the my choice and if apply is...
3
26316
by: kalyanibal | last post by:
can anybody help me out with my problem. in my submit form i have three radio buttons with the title "Mr,Mrs,Miss". how to select one radio button from the above three by using c# code behind. also i have another two radio buttons titled "residential and commercial", how to choose one radio button from the above two using C# code with...
1
3108
by: lolodede | last post by:
i have php page with 4 radio buttons and text box if user chose first two radio buttons then the next page need to display the results depending which radio buttons select but other two depend on value on textbox entered then spefic fields should be shows but i have no idea how to do that how can i get radio buttons <?php ...
0
8138
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7983
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6287
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...
1
5514
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3657
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...
0
3647
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2117
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
1
1228
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
946
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...

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.