0 Replies Latest reply on Apr 25, 2012 2:52 PM by jn.colin

    Problems disabling dependent component




      Although this seems to be a basic use of RichFaces 4.2.1, I can't get it to work. I have a checkbox bound to a Request-scoped bean's boolean variable; when unset, I want to disable the following inputText; when set, I want to have it enabled. Note that the form contains other fields which require other validation (in particular some required fields)


      My understanding is that I have to do a partialSubmit on the checkbox using a4j:ajax, and re-render both components; here's the way I do it:


        <h:panelGrid columns="3" styleClass="registerTable"


        <h:outputLabel for="groupRegistration" value="Group registration" />

        <h:selectBooleanCheckbox id="groupRegistration"



        <a4j:ajax execute="@this" render="@this numParticipants" />


        <rich:message for="groupRegistration" ajaxRendered="true" />


        <h:outputLabel id="numParticipantsLabel" for="numParticipants"

        value="Number of participants" />

        <h:inputText id="numParticipants"


        value="#{visitorBean.numParticipants}" width="5"

        requiredMessage="Required field" converter="javax.faces.Integer"

        converterMessage="Invalid number">


        <rich:message id="numParticipantsMsg" for="numParticipants"

        ajaxRendered="true" />



      When I set the checkbox, the inputtext gets enabled; the issue is that when I enter data, and submit the form through a a4j:commandButton (invoking an Action method on the bean), the model value doesn't get updated, just as if the inputtext was not enabled on the backend.(actually, I'm pretty sure that the problem comes from the fact that the field in the backend is still disabled, and thus not updated upon form submission)


      What did I get wrong? How can I achieve this?


      Thanks for your help