Wicket RadioChoice default selected

radio-button, wicket

Solution

From an HTML point of view, it's not recommended to omit the pre-selected radio value (see http://www.w3.org/TR/html401/interact/forms.html#radio). It's also rather irritating for the user, since there's no way to unselect all values within a radio group if he/she accidentally clicks one. You should probably rethink your UI - is there room for a third 'Unknown' option?

Problem

I have a RadioChoice component with an attached model. The radio choice is associated with a boolean field, hence I have to radio buttons (yes/no). My problem is that the no-button gets pre-selected when the page renders, because the boolean field is set to false. Is there a way to prevent this from happening, as I don't want to have a pre-selected value. Any ideas are greatly appreciated. Thank you!

Original source