且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

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

更新时间:1970-01-01 07:58:30

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

<label for="radio-button">Radio button label text</label>
<input type="radio" value="1" name="radio-button" id="radio-button"/>

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

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

I am able to select user preferences by directly clicking on the text next to the radio button choice in all browsers except Firefox. How should I fix this?

You need to add a <label> element for the radio button so that your markup looks as follows:

<label for="radio-button">Radio button label text</label>
<input type="radio" value="1" name="radio-button" id="radio-button"/>

The for and id attributes of the tags must match. To create this label, you can use the <h:outputLabel/> tag.