无法通过单击选择文本来选择特定的单选按钮选择 [英] Unable to select a particular radio button choice by clicking on the choice text

查看:45
本文介绍了无法通过单击选择文本来选择特定的单选按钮选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

在Firefox以外的所有浏览器中,我都可以通过直接单击单选按钮选项旁边的文本来选择用户首选项.我该如何解决?

解决方案

您需要为单选按钮添加<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.

这篇关于无法通过单击选择文本来选择特定的单选按钮选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆