• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

Radio Buttons

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello All
How do I de-select the radio button. Basically i have two radio buttons with the same name (same group). Once the page(form) is loaded in the browser both the radio buttons are unselected. But after the user clicks one of the radio button, that becomes enabled. Is it possible for me to programatically de-select (in the sense both the radio buttons should not appear to be selected as it was when the page was loaded).
Appreciate your help....
Thanks a bunch
Chandar
 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
The code below does not select any radio button.
<p><input type="radio" value="V1" name="R1">Yes</p>
<p><input type="radio" value="V2" name="R1">No</p>
But the code below selects the 'Yes' radio button because the checked parameter has been added to the 'Yes'.
<p><input type="radio" value="V1" name="R1" checked>Yes</p>
<p><input type="radio" value="V2" name="R1">No</p>
So if you do not add the 'checked' to any of the radio buttons, none of them will be selected when the form loads.

 
Chandar Vel
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
I want to reset it with the javascript. How do I do that?
Chandar
 
Ranch Hand
Posts: 3244
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Chandar
to do it the way you want to, in your code use this:
document.formName.groupName[index].checked = false;
formName is the name of the form that the two buttns are on, groupName would be the name of the two buttons you have, and index is either 0 or 1 for the first or second button.
hth
Dave
 
It's weird that we cook bacon and bake cookies. Eat this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic