Я пытаюсь сделать так, чтобы компонент h: selectBooleanCheckbox заставлял другой h: inputbox отключаться, когда флажок установлен в true (проверено).
Есть несколько версий, которые я попробовал, но ни одна из них не удалась (Когда я установил флажок, ничего не происходит)
Версия 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>
Версия 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)
Спасибо!