0
私は、JSFのBacked beanの2つのインスタンス変数によってバックアップされた2つのラジオボタンを持っています。また、チェックされている場合は、他のものを無効にする必要があります。私のコードは以下の通りです。何が間違っていますか?なぜ私は期待どおりに動作しません。JSF SelectOneRadioボタンを無効にすることはできません
適切なヘルプをいただければ幸いです。
<h:graphicImage url="/images/orange_arrows.gif" />
<h:outputLabel for="addBundle">
<h:outputText value="Subscribe Bundle :" styleClass="item-name"/>
</h:outputLabel>
<h:selectOneRadio id="addBundle" value="#{accountAdjustmentBean.bundleAdded}" required="false"
onchange="enableSubmit(this.checked != bundleAdded);disableRadioButton('unsubscribe');">
<f:selectItem id="subscribe" itemValue="true"/>
<h:message styleClass="errors" for="addBundle"/>
</h:selectOneRadio>
<h:panelGroup/>
<h:graphicImage url="/images/orange_arrows.gif" />
<h:outputLabel for="removeBundle">
<h:outputText value="Unsubscribe Bundle" styleClass="item-name"/>
</h:outputLabel>
<h:selectOneRadio id="removeBundle" value="#{accountAdjustmentBean.bundleRemoved}" required="false"
onchange="enableSubmit(this.checked != bundleRemoved);disableRadioButton('subscribe');">
<f:selectItem id="unsubscribe" itemValue="true"/>
<h:message styleClass="errors" for="removeBundle"/>
</h:selectOneRadio>
<h:panelGrid columns="1" styleClass="adjustments-submit">
<h:commandButton id="submitBtn" action="#{accountAdjustmentBean.addDataBundleAction}"
value="Submit"/>
<f:verbatim>
<script type="text/javascript">
function enableSubmit(enable) {
document.getElementById('ccAcountStatus:submitBtn').disabled = !enable;
}
// Disable submit button on load (enable when account locked status changes)
enableSubmit(false);
function disableRadioButton(elementId) {
document.getElementById(elementId).disabled = true;
}
// save the account locked status at page load. used to detect if changed.
var bundleadded = </f:verbatim><h:outputText value="#{accountAdjustmentBean.bundleAdded}"/><f:verbatim>
</script>
</f:verbatim>
ラジオボタンに変更があった場合に送信ボタンを有効/無効にすることができます。同様に、これらのラジオボタンを有効/無効にできませんか? –