单选按钮onclick不会更改值

时间:2014-02-17 10:59:23

标签: javascript html radio-button radiobuttonlist pega

我正在尝试执行以下JS。我有一个单选按钮,单击时应该将变量RefreshMapping的属性设置为子代码,如下面的代码所示。然而,这似乎并没有奏效。我已将RefreshMapping的默认值设置为模板,每次我选择单选按钮时,值应更改为child,而不是。任何帮助将不胜感激。

</script>
<SPAN nowrap>
<body>
<table cellpadding='0' cellspacing='0' width=''>
<tr> 
<td class='{DataValueWrite}' nowrap='nowrap' width='' align="top">

   <input <pega:include name="ClientValidation"/> type="radio" class="Radio" name="<pega:reference name="$this-name" />"  onclick="document.getElementById('RefreshMapping').value='child';document.getElementById('RefreshMapping').click();" id="<pega:reference name="$THIS-DEFINITION(pyPropertyName)" />"

                    <pega:when java="<%= tools.getProperty("SelectedProduct.ChildProd").toString().equals("child") %>"> checked 
 </pega:when>
<pega:when java="<%= tools.getProperty("SelectedProduct.PROD_LEVEL").toString().equals("5") %>">
        disabled                  
    </pega:when>

value="true"><font class = "LabelName">Child Sub-Product/ Services</font>

</td>

    </tr>
 </table> 
</body>
</SPAN>

P.S:这是一个名为Pega PRPC的工具,因此请忽略PEGA特有的语法

1 个答案:

答案 0 :(得分:1)

首先,你的html似乎格式不正确,为什么在spans里面有body标签。

其次,你确定页面上有一个id为'RefreshMapping'的html元素吗?验证是否是您尝试获取此单选按钮的结果。

第三,您输入的值当前通过'value =“true”'设置为“true”,要在javascript中选择单选按钮,您必须将元素设置为选中。这将为name属性中指定的属性提供输入'value属性的值。单选按钮通常具有到同一单选按钮组的多个输入标签,为了选择该组中的按钮,您将获得该特定元素并将其设置为通过document.getElementByID(“id”)进行检查.check =“true”; < / p>

相关问题