6 Replies Latest reply on Aug 14, 2009 6:36 PM by nbelaevski

    a4j:support Troubles


      I've got a problem when using a4j:support.

      Here's the code:

      <s:decorate id="someDecorator" template="/layout/edit.xhtml">
       <ui:define name="label">someField</ui:define>
       <h:inputText disabled="false" readonly="false" id="someInputId" required="false" value="#{someBean.chosenEntity.someValue}">
       <a4j:support event="onblur" reRender="someDecorator" bypassUpdates="true" ajaxSingle="true"/>

      When I edit this field and don't save it and change someBean.chosenEntity, the value won't get updated. It should have a new value, though, since the entity switched. This behaviour does not occur without a4j:support.

      Problem 2:

      When I edit a field and press the submit Button, I gotta press it twice to call the buttons action. This is related to a4j:support, too.

      How to solve these problems?

        • 1. Re: a4j:support Troubles

          problem 2 related to concurrent requests. blur occurs together with button press. try to use queue.

          and on first one - show more code to check how did you trying to change it's value.

          • 2. Re: a4j:support Troubles


             var="item" value="#{controller.model}"
             reRender="scroller, datatableHeader, footer, dialog"
             <f:facet name="header">Actions</f:facet>
             <a4j:commandLink id="editlink" action="#{controller.select(item)}" reRender="dialog, datatable"
             onClick="this.focus(); return false;">
             <h:graphicImage value="/img/edit.gif" style="border:0"/>
             <f:setPropertyActionListener value="#{true}" target="#{controller.editMode}" />
             <rich:toolTip for="editlink" value="Edit"/>
             <h:form id="dialogForm">
             <a4j:outputPanel id="dialog" ajaxRendered="true" width="500px">
             <div class="scrollable" style="width: 500px;">
             <rich:panel id="dialogPanel">
             <rich:messages level="INFO" ajaxRendered="true" id="messages" />
             <f:facet name="header">
             <h:outputText value="Edit"/>
             <h:panelGrid columns="2">
             <f:facet name="beforeInvalidField">
             <f:facet name="afterInvalidField">
             <h:graphicImage src="/img/error.gif"/>
             <a4j:outputPanel ajaxRendered="true">
             <f:facet name="aroundInvalidField">
             <s:span styleClass="errors"/>
             <s:decorate id="someDecorator" template="/layout/edit.xhtml">
             <ui:define name="label">Label</ui:define>
             <h:inputText disabled="false" readonly="false" id="someFieldId" required="false" value="#{controller.selectedEntity.someValue}">
             <a4j:support event="onblur" reRender="someDecorator" bypassUpdates="true" ajaxSingle="true"/>
             <rich:panel style="text-align:right; border-color: white;" >
             <a4j:commandButton value="Save" id="saveButton" reRender="datatable, dialog, messages" action="#{controller.saveSelectedEntity}"/>

            The code looks like this. The commandLink inside the datatable calls the select action. When I now edit a field in the dialog and then call the select action again, the value in the field is still the same, although the selected entity has an other value. Confusing, isn't it?

            • 3. Re: a4j:support Troubles

              Sorry, there are some mistakes in it and I can't edit it :(

              It's missing the tag and the </a4j:region> tag.

              • 4. Re: a4j:support Troubles

                make the links in dataTAble ajaxSingle.

                • 5. Re: a4j:support Troubles

                  That won't help.

                  Workflow is like that:

                  1.) Press Edit-Link => Dialog is filled with values
                  2.) Change contents of a field inside the dialog
                  3.) Do NOT Save and don't do anything else
                  4.) Press Edit-Link on another item
                  => Contents of the field aren't updated with values from the new entity but still have the value that we put in and didn't save

                  • 6. Re: a4j:support Troubles


                    Looks like https://jira.jboss.org/jira/browse/RF-7136. Please check the issue and blog link in comments.