473,785 Members | 3,142 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to uncheck a radiobutton

18 New Member
hi all..
i have a small doubt.. i have two radiobutton on my page.. both unchecked initally.. on clicking either of the radiobutton few apporiate html contols ll appear.. after submitting the form and clicking the back button of my browser one radiobutton is in the clicked mode but its respective contoles are not appearing..

can anyone guide me with an answer.. thanks in advance..

i used //document.g.gg.c hecked = false;
its aint working..

Aswath.N.S
(knowledge is power)
Mar 22 '08 #1
6 4212
gits
5,390 Recognized Expert Moderator Expert
hi ...

please post the code you already have. you could call a function onload of the page that inits the state of the buttons ... but i think it would be better to see what you have so far at first ...

kind regards
Mar 22 '08 #2
RamananKalirajan
608 Contributor
hi all..
i have a small doubt.. i have two radiobutton on my page.. both unchecked initally.. on clicking either of the radiobutton few apporiate html contols ll appear.. after submitting the form and clicking the back button of my browser one radiobutton is in the clicked mode but its respective contoles are not appearing..

can anyone guide me with an answer.. thanks in advance..

i used //document.g.gg.c hecked = false;
its aint working..

Aswath.N.S
(knowledge is power)

Hello Aswanth, I hope this code may be helpful for you. if more doubt pls post back your code

[HTML]<html>
<head>
<script type="text/javascript">
function doThis()
{
var x = document.getEle mentById('opt1' ).value;
if(x==1)
document.getEle mentById('opt2' ).value=0;
else
document.getEle mentById('opt1' ).value=1;
}
</script>
</head>
<body>
<input type="radio" name="rad" id="opt1" onclick="doThis ()">Select1<b r/>
<input type="radio" name="rad" id="opt2" onclick="doThis ()">Select2
</body>
</html>[/HTML]

Regards
Ramanan Kalirajan
Mar 22 '08 #3
aswath
18 New Member
hi frnds..
thanks for ur attempts.
i tried init the form on load of the form.. aint working....
below is the code that i used..

[HTML] <script language="javas cript">
function call(){

if(document.g.m odi_id.checked= =true){
// alert(document. g.category1.val ue);
document.getEle mentById('modif y_txt').style.d isplay= 'block';
document.getEle mentById('add_n ew_txt').style. display= 'none';

}
if(document.g.a dd_id.checked== true){
// alert(document. g.category2.val ue);
document.getEle mentById('add_n ew_txt').style. display= 'block';
document.getEle mentById('modif y_txt').style.d isplay= 'none';
}

}
</script>
</head>
<body>
<form name="g" action="index.j sp">

modify<input type="radio" name="category" id="modi_id" value="modify" onclick="call() ;"/>
add new<input type="radio" name="category" id="add_id" value="add_new" onclick="call() ;"/>
<input type="text" class="text" id="modify_txt " value="modify" />
<input type="text" class="text" id="add_new_txt " value="add" />
<input type="submit" value="submit" />

</form>[/HTML]

now all i want to do is, on submitting the form and comming back to the same page i want those radiobuttons to be unchecked(some kind of page refrersh ll help i think, however am unable to do it)..
thanks frnds...
Mar 24 '08 #4
gits
5,390 Recognized Expert Moderator Expert
hi ...

as i said you just have to call a init-function on page load ... have a look at the example:

Expand|Select|Wrap|Line Numbers
  1. function init_radios() {
  2.     var r = document.getElementsByTagName('input');
  3.  
  4.     for (var i = 0, n; n = r[i]; i++) {
  5.         if (n.type == 'radio') {
  6.             n.checked = false;
  7.         }
  8.     }
  9. }
  10.  
now call that in the onload:

[HTML]<body onload="init_ra dios();">
[/HTML]
that function unchecks all radio-buttons on your page

kind regards
Mar 24 '08 #5
aswath
18 New Member
thanks a lot pal.. its working..

regards,
aswath.n.s
(knowledge is power)
Mar 25 '08 #6
gits
5,390 Recognized Expert Moderator Expert
:) ... no problem ... post back to the forum anytime you have more questions ...

kind regards
Mar 25 '08 #7

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

Similar topics

8
2852
by: VK | last post by:
Hi! What I'm missing in following code? Cannot get the values of radiobuttons. Starting only one class (GetVariant), it works. When I put two classes together, it doesn't. Regards, VK from Tkinter import * class GetVariant: def __init__(self): self.root = Tk()
11
7874
by: William Gill | last post by:
I am placing radiobuttons in a 4 X 4 matrix (using loops) and keep references to them in a 2 dimensional list ( rBtns ). It works fine, and I can even make it so only one button per column can be selected, by assigning each column to an intVar. In many languages a radiobutton has a property that can be directly read to see if it is selected on unselected. Tkinter radiobuttons don't seem to have any such property. Is there any way to...
0
4139
by: rodrigo | last post by:
I have a Asp.net table control that I dynamically add rows from a SQL database. Inside the table, I add radiobuttons and they all have different ID numbers according to BindChain() Looking In BindChain() Sub for the line: AddHandler Rb.CheckedChanged, AddressOf BindAssembly_Click
3
36185
by: sofie | last post by:
Hello all, I use the following javascript function in a html document to set the level of one of eight available radiobuttons. The line that's commented out works fine under IE, but I need to rewrite it so that it's W3C compliant. Reading through earlier messages I concluded I should go with getElementById but this doesn't work. What am I doing wrong? Your help is much appreciated.
3
7284
by: dave | last post by:
I have half a dozen web form radio buttons on a web form. Each of them is set to postback=true. However, if for instance radiobutton1 is already selected and the user selects it again, it performs a postback. I only want to do a postback if the value of the radiobutton is changed. What is the best method to accomplish this? thx dave
0
3234
by: Sieber Christoph | last post by:
Hallo ich habe eine WebForm und habe da eine Gruppe mit Radiobuttons die beim laden der seite den status unchecked haben. Wenn ich jetzt aber auf einen der RadioButtons klicke, dann habe ich immer mind. einer aktiviert. Wie kann ich es machen, dass ich, wenn ich nochmals auf den RadioButton klicke, der gerade checked ist, dieser wieder unckecked gesetzt wird???
6
9294
by: Radiobutton via DotNetMonster.com | last post by:
i need help with radiobuttons. i am useing 1button and 2 radiobuttons i am trying to make it so when u select a radiobutton and hit button1 it will clear radiobuttons 1 and 2. -- Message posted via DotNetMonster.com http://www.dotnetmonster.com/Uwe/Forums.aspx/dotnet-csharp/200605/1
4
1610
by: Igor | last post by:
RadioButton have property Checked (true or false). If I make RadioButtons with code, without drawing by mouse than I have problems. I write like this: Dim rb(0 To 2) As RadioButton Dim n As Integer For n = 0 To 2 rb(n) = New RadioButton rb(n).Text = "Text: " + CStr(n)
8
44043
by: =?Utf-8?B?UmljaA==?= | last post by:
If you enclose a group of radiobuttons (option buttons in MS Access) in an option group control (a frame control) in Access -- the frame control will return the index of the option button that is checked. In VB.Net if I enclose a group of radiobuttons in a groupbox control - I get the single checked radiobutton behavior, but the groupbox does not seem to return the index of the checked radiobutton. Is there a way to get the groupbox...
0
9645
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10151
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10092
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
9950
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7499
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6740
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3647
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2879
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.