3 Replies Latest reply on Jun 12, 2015 11:38 AM by kkn

    Multiple <a4j:status> issue in Richfaces 4

    kkn

      Hi,

       

      I have multiple regions on my xhtml page. Every region has one <a4j:status> tag.

       

      With richfaces 3, the ids for different <a4j:status> tag were like below

       

      accessForm:j_id191:status

      accessForm:j_id243:status

      accessForm:j_id289:status

       

      After migrating to richfaces 4.5x, I am receiving a DuplicateIdException as the ids for all the <a4j:status> tags is accessForm:status.

       

      I read the documentation and found that for id attribute in <a4j:status> tag - The component identifier for this component. This value must be unique within the closest parent component that is a naming container.

       

      The code is as below

      <h:form id="form">

        <a4j:region>

        <table>

        <tr>

        <td>

        <a4j:region>

        <a4j:outputPanel id="text">

        <h:messages errorClass="msg" infoClass="green"  layout="table"  />

        <h:inputTextarea

        id="txt"

        value="#{text}"/>

        </a4j:outputPanel>

        </a4j:region>

        </td>

        </tr>

        <tr>

        <td align="right" width="55%">

        <a4j:commandButton

        action="#{action}"

        value="Save"

        onclick="if (!validate()){return false;}isAjaxSubmission = true; "

        render="text"

        id="saveText"

        title="Save"/>

        &#160;&#160;

        </td>

        <td width="45%" align="left">

        <a4j:status id="status">

        <f:facet name="start">

        <h:graphicImage value="ajax_process.gif" />

        </f:facet>

        </a4j:status>

        </td>

        </tr>

        </table>

        </a4j:region>

       

        <a4j:region renderRegionOnly="true">

        <ui:define name="sectionContent">

        <a4j:outputPanel id="tMsg">

        <h:messages errorClass="msg" infoClass="green"  layout="table"  />

        </a4j:outputPanel>

        <a4j:outputPanel id="tCover" ajaxRendered="true">

        <table width="100%">

        <tr>

        <td colspan="2">

        SettleIt

        </td>

        <td>

        <a4j:outputPanel ajaxRendered="true">

        <h:panelGroup rendered="#{action}">

                    <h:selectOneMenu

                    id="dropdown"

                    value="#{value}">

                    <a4j:ajax 

                    event="change"

                    render="sdropdown,rendercheck,rejectRendercheck,rejectStatusdropdown,tCover"

                    onsubmit="javascript: setShowAll();"/>

                    <f:selectItem itemValue=" " itemLabel="" />

                    <f:selectItems value="#{handlerBean.list}" />

                    </h:selectOneMenu>

                    <a4j:status id="status">

        <f:facet name="start">

        <h:graphicImage value="ajax_process.gif" />

        </f:facet>

        </a4j:status>

        </h:panelGroup>

                  </a4j:outputPanel>

        </td>

        </tr>

        <tr>

        <td>

        <a4j:outputPanel id="sdropdown" ajaxRendered="true">

                    <h:selectOneMenu

                    value="#{handlerBean.id}"

                    id="advanceId"

                    styleClass="smallfont">

                <f:selectItems value="#{handlerBean.list}" />

              </h:selectOneMenu>

              </a4j:outputPanel>

        <a4j:outputPanel id="rendercheck">

        <h:selectBooleanCheckbox id="showall">

        <a4j:ajax

        event="onclick"

        onsubmit="javascript: setShowAll();"

        render="sdropdown"/>

        <font class="headerfont">Show All</font>

        </h:selectBooleanCheckbox>

        </a4j:outputPanel>

        </td>

        </tr>

        <tr>

        <td>

        <a4j:outputPanel id="rdropdown" ajaxRendered="true">

                    <h:selectOneMenu

                    value="#{handlerBean.id}"

                    id="rId">

                <f:selectItems value="#{rList}" />

              </h:selectOneMenu>

              </a4j:outputPanel>

        <a4j:outputPanel id="rOutput">

        <h:selectBooleanCheckbox id="rShowall">

        <a4j:ajax

        event="click"

        onsubmit="javascript: setShowAll();"

        render="rdropdown"

        />

        <font>Show All</font>

        </h:selectBooleanCheckbox>

        </a4j:outputPanel>

        </td>

        </tr>

        </table>

        </a4j:outputPanel>

        </ui:define>

        </a4j:region>

        </h:form>

       

      Can you please help in understanding how the implementation of <a4j:status> tag has been upgraded in 4.

       

      Thank you!

        • 1. Re: Multiple <a4j:status> issue in Richfaces 4
          michpetrov

          Hi,

           

          <a4j:region> is not a naming container so you have to give different ids to your statuses. Out of our components only the ones used for iteration are naming containers.

          • 2. Re: Multiple <a4j:status> issue in Richfaces 4
            kkn

            Hi,

             

            I tried giving different ids for each status tags but then I ran into multiple issues.

             

            1. The image <h:graphicImage value="ajax_process.gif" /> stopped showing for the save.

            2. After the save ajax request is completed, the save message which is coming from backing bean, is showing up in all sections.


            I checked that correct backing bean action is being called but all the message sections are updated with success message. The backing bean method is pretty simple which is returning success message after save is complete.

            • 3. Re: Multiple <a4j:status> issue in Richfaces 4
              kkn

              Also, is this behavior "<a4j:region> is not a naming container so you have to give different ids to your statuses"

              From richfaces 4? Because dynamic Ids were generated for multiple status tags in 3x