2 Replies Latest reply on Apr 26, 2012 11:13 AM by Jean-Noel Colin

    disabling/enabling component with ajax not working

    Jean-Noel Colin Newbie



      I have a simple form with three fields; one checkbox and two text fields, one of which should be enabled when the checkbox is ticked. Using the <a4j:ajax> tag, I'm able to enable/disable it on the UI side, but on the backend side, the component is always disabled, which means that the request value are never set, don't get validated and don't get to the model. Here the code I'm using; the first component is the checkbox, the second is the text field to be disabled and the third is a simple textfield. If I tick the checkbox, the text field gets enabled, but when I submit the form, the value is always set to 1 (the default value). Could anyone help me with solving this?


      Many thanks





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


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

        <h:selectBooleanCheckbox id="groupRegistration"



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


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


        <h:outputLabel for="numParticipants" value="Number of participants" />

        <h:inputText id="numParticipants"

        disabled="#{!registrationBean.groupRegistration }"

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

        converter="javax.faces.Integer" converterMessage="Invalid number">


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


        <h:outputLabel for="firstName" value="Firstname" />

        <h:inputText id="firstName" value="#{registrationBean.firstName}"



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