无法通过单击选择文本来选择特定的单选按钮选项

Ach*_*ius 1 html css jsf seam richfaces

<s:decorate template="/layout/display-text.xhtml">
    <h:selectOneRadio layout="pageDirection" value="#{_userHome.pref}">
        <f:selectItems value="#{_userHome.getPreferences()}" />
    </h:selectOneRadio>
</s:decorate>
Run Code Online (Sandbox Code Playgroud)

我可以通过直接单击除Firefox之外的所有浏览器中单选按钮选项旁边的文本来选择用户首选项.我该怎么解决这个问题?

Pat*_*Pat 6

您需要<label>为单选按钮添加元素,以便标记如下所示:

<label for="radio-button">Radio button label text</label>
<input type="radio" value="1" name="radio-button" id="radio-button"/>
Run Code Online (Sandbox Code Playgroud)

标签的forid属性必须匹配.要创建此标签,您可以使用该<h:outputLabel/>标签.