• 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
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

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
 
I yam what I yam and that's all that I yam - the great philosopher Popeye. Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic