Consider the following situation: you would like a set of radio buttons on a form that will have a value preselected. You don’t want to give the user the option to change the selected radio button, but you do want to submit that value with the form.
Using the disabled attribute doesn’t work because it doesn’t submit the value with the form. Using the readonly attribute doesn’t work with radio buttons.
This can be accomplished by simply adding an onclick=”return false;”. This also allows the radio buttons to look normal without being grayed out.
The only caveat I’ve found with this is that the selection has to be made ahead of time or the first one the user clicks on will be selected and then the user cannot select another one. One way of dealing with this is by using a default value you would like submitted with the form if none of the values are selected. Then just use a style=”display:none;” to hide this button from the user. All the other radio buttons will remain unselected and unable to change.