"h:selectBooleanCheckbox"コンポーネントをチェックボックスがtrue(チェック)に設定されていれば、別のh:inputboxを無効にします。h:selectBooleancheckboxをチェックしたら、h:inputboxを無効にする
バージョン1
<f:view>
<h:form id="MyForm">
<h:panelGrid id="OutgoingMailPanel" styleClass="subConfigurationPanel">
<h:panelGrid columns="1">
<h:outputText styleClass="propertyName" value='Password' />
<h:outputText styleClass="properyDescription" value='Password for the incoming mail server' />
<h:inputText id="OutGoingMail" styleClass="propertyInput" value="#{email.currentOutgoingMailPassword[0]}" />
</h:panelGrid>
<h:panelGrid columns="1">
<h:panelGroup>
<h:selectBooleanCheckbox value="#{email.currentUsePasswordSameAsIncoming[0]}"
onclick="document.getElementById('MyForm:OutGoingMail).disable = !this.checked" />
<h:outputText styleClass="propertyName" value='Outgoing Password Same As Incoming.' />
</h:panelGroup>
</h:panelGrid>
</h:panelGrid>
</h:form>
</f:view>
バージョン(I]チェックボックスをオンにすると、何も起こりません)私が試したし、どれも成功していないいくつかのバージョンがあります2
<f:view>
<h:form id="MyForm">
<h:panelGrid id="OutgoingMailPanel" styleClass="subConfigurationPanel">
<h:panelGrid columns="1">
<h:outputText styleClass="propertyName" value='Password' />
<h:outputText styleClass="properyDescription" value='Password for the incoming mail server' />
<h:inputText id="OutGoingMail" styleClass="propertyInput" value="#{email.currentOutgoingMailPassword[0]}"
disabled="#{email.currentUsePasswordSameAsIncoming[0]}"/>
</h:panelGrid>
<h:panelGrid columns="1">
<h:panelGroup>
<h:selectBooleanCheckbox value="#{email.currentUsePasswordSameAsIncoming[0]}" >
<a4j:support event="onclick" rerender="OutGoingMail">
</h:selectBooleanCheckbox>
<h:outputText styleClass="propertyName" value='Outgoing Password Same As Incoming.' />
</h:panelGroup>
</h:panelGrid>
</h:panelGrid>
</h:form>
</f:view>
どちらのバージョンも同じ理由で動作しません。ボックスにチェックを入れると何も起こりません。 すべてのアイデア? (Jsf1.2、myfaces、richfacesの操作)
ありがとう!お使いのバージョン1では
感謝しなければなりません。うまくいきませんでした... – Ben
@Ben - 私と同じように動作します、urコードの3つの変更を確認してください、1.Closing ')要素idの最後に2.無効にして修正しました。 – niksvp
ありがとうございます。私はあなたの解決策を確認するために回っていませんでした。なぜなら、2つのバリエーションを使用していたからです。しかし、公平のために。私は答えとしてマークします。 – Ben