3 Replies Latest reply on Dec 29, 2008 8:00 PM by Tom ONeill

    ReRender Following Checking Checkbox

    Dave Everson Newbie


      I have a checkbox on a form that if checked I want additional fields to appear. These additional fields are only applicable if the checkbox is checked.

      I can not get these fields to display when the checkbox is checked.

      Environment: JBoss 4.2.1GA, Seam 2.1.1GA, Richfaces 3.2.2

      I have attached snippets of the code below. Could someone take a quick look and let me know if they see anything that is wrong.


       <a4j:form id="frm">
       <rich:simpleTogglePanel switchType="client" label="Basic Information">
       [...additional fields removed...]
       <a4j:region renderRegionOnly="true">
       <s:decorate id="enableLateFeeDecorate" template="../common/edit.xhtml">
       <ui:define name="label">Enable Late Fees:</ui:define>
       <h:selectBooleanCheckbox id="enableLateFee" value="#{editRegistrationPeriod.detail.enableLateFee}">
       <f:attribute name="messageLabel" value="Enable Late Fees"/>
       <a4j:support event="onclick" reRender="lateFeeEntryContainer"/>
       <a4j:outputPanel id="lateFeeEntryContainer">
       <s:div id="lateFeeEntry" rendered="#{editRegistrationPeriod.detail.enableLateFee}">
       <s:decorate id="lateFeeDecorate" template="../common/edit.xhtml">
       <ui:define name="label">Registration Late Fee:</ui:define>
       <h:inputText id="lateFee" size="50" maxlength="48" required="false" value="#{editRegistrationPeriod.detail.lateFeeAmount}">
       <f:attribute name="messageLabel" value="Registration Late Fee Amount"/>
       <s:decorate id="lateFeeEffectiveDateDecorate" template="../common/edit.xhtml">
       <ui:define name="label">Late Fee Effective Date:</ui:define>
       <rich:calendar value="#{editRegistrationPeriod.detail.lateFeeEffectiveDate}" datePattern="MMM d,yyyy" cellWidth="24px" cellHeight="22px" style="width:200px">
       <f:attribute name="messageLabel" value="Registration Late Fee Effective Date"/>
       [...additional toggle panels and content removed...]

        • 1. Re: ReRender Following Checking Checkbox
          Nick Belaevski Master


          Can you please add rich:messages component to the page and check if there are any?

          • 2. Re: ReRender Following Checking Checkbox Issue
            Dave Everson Newbie

            I added the <rich:messages/> tag.
            No messages are displayed following the checking of the checkbox.

            I can't figure out what is going wrong here! Hopefully someone can help me out.

            • 3. Re: ReRender Following Checking Checkbox
              Tom ONeill Newbie

              We have seen a similar problem. I will do my best to clearly describe it.

              We have a modal panel that initially has just three fields rendered, one of them a date. When a valid date is input, several more fields render, one of them a checkbox. That checkbox has an a4j:support event on it which causes other fields to be rendered when the checkbox is checked. When a valid date is input, we would like the checkbox to be initially checked (and the rich:panel displayed). However, when we initialize the checkbox to checked, the rich:panel associated with it does not get rendered when the valid date is input. If the user unchecks the box, then re-checks it, then the panel gets rendered. Our workaround was to make the checkbox default to un-checked even though 99% of the time the user will want it to be checked.