• 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
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

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
 
and POOF! You're gone! But look, this tiny ad is still here:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic