function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Once selected, radio buttons cannot be deselected



I am using radio buttons in my VF page. I noticed that you can change the selection, but not deselect any from being chosen. Is this unavoidable?


That is the function of a "radio" button when used separately. You can use them in a Radio button group where a bunch of radio buttons toggle when once of the radio buttons in the group is selected. 


With that said, you could use a javascript function to "deselect" the radio button or set the value to "false" in the controller.


not sure how I can set the value to false in the controller, when the radio button is selected the controller is not called unless I press "submit" the form... I just need some kind of event to let the user to deselect the radio button... nothing to do with the controller...


could you paste an example with Javascript? Thanks!


isn't this by nature in regards to radio buttons?  i've never seen a standard HTML form with these that didn't have this limitation.  we always worked around it by using a control of custom stylized checkboxes that were made to look like radio buttons.

sharan swaroop Bikkumandlasharan swaroop Bikkumandla
Is anyone able to solve this issue? am having the same issue and wasn't able to figure out anything! I agree with lopezc that it has nothing to do with the controller!