2011-01-11 2 views
1

"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에서

답변

1

버전 2에서

document.getElementById('MyForm:OutGoingMail').disabled = this.checked

+0

감사해야합니다. 작동하지 않았다 ... – Ben

+0

@Ben - 나와 같은 똑같은 작동, 요소 코드의 끝에 ur 코드, 1.Closing ')의 세 가지 변경 사항 확인, 2. 사용 안 함, 수정 됨, 3.'! ' – niksvp

+0

감사합니다. 나는 효과가있는 2의 변형을 사용했기 때문에 해결책을 확인하지 못했습니다. 하지만 공정성을 위해서. 나는 그것을 답으로 표시 할 것이다. – Ben

0

로 코드를 수정, 다시 쓰게은 다시 쓰게