如何识别在冰面中选择哪个单选按钮?

时间:2014-10-17 07:38:47

标签: javascript radio-button icefaces-1.8

我有3个单选按钮,我想确定选择哪个单选按钮进行进一步处理。我试过了

的document.getElementById( “minselected”); 也  。的document.getElementById( “minselected”)isSelected(); 和

document.getElementByName( “MIN”);

但它不起作用。

1 个答案:

答案 0 :(得分:0)

如果您使用icefaces,则不必使用任何javascript tweek来获取复选框值。

尝试使用ice:selectOneRadio组件。
示例代码如下所示

<ice:selectOneRadio layout="pageDirection"
    partialSubmit="true" value="#{myBean.myButtonValue}">
    <f:selectItem id="1"
        itemLabel="val1"
        itemValue="val1" />
    <f:selectItem id="2"
        itemLabel="val2"
        itemValue="val2" />
    <f:selectItem id="3"
        itemLabel="val3"
        itemValue="val3" /> </ice:selectOneRadio>

其中 myBean 是我的bean名称
myButtonValue 是bean中带有getter setter的字符串变量

当您提交表单时,您将在变量 myButtonValue

中的bean中获得 itemValue