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

    a4j:support Troubles

    John Doe Newbie

      Hi,

      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"/>
       </h:inputText>
       </s:decorate>


      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
          Ilya Shaikovsky Master

          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
            John Doe Newbie

             

            <rich:dataTable
             id="datatable"
             rows="#{controller.pageSize}"
             var="item" value="#{controller.model}"
             width="100%"
             reRender="scroller, datatableHeader, footer, dialog"
             >
            
             <rich:column>
             <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}" />
             </a4j:commandLink>
             <rich:toolTip for="editlink" value="Edit"/>
             </rich:column>
            
            <a4j:region>
            
             <h:form id="dialogForm">
             <a4j:outputPanel id="dialog" ajaxRendered="true" width="500px">
             <div class="scrollable" style="width: 500px;">
             <h:panelGroup>
             <rich:panel id="dialogPanel">
            
             <rich:messages level="INFO" ajaxRendered="true" id="messages" />
            
             <f:facet name="header">
             <h:outputText value="Edit"/>
             </f:facet>
             <h:panelGrid columns="2">
             <f:facet name="beforeInvalidField">
             </f:facet>
             <f:facet name="afterInvalidField">
             <h:graphicImage src="/img/error.gif"/>
             <a4j:outputPanel ajaxRendered="true">
             <s:message/>
             </a4j:outputPanel>
             </f:facet>
             <f:facet name="aroundInvalidField">
             <s:span styleClass="errors"/>
             </f:facet>
            
            
            
            
            
            
            
            
            
             <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"/>
             </h:inputText>
            
            
             </s:decorate>
            
            </h:panelGrid>
            
             <rich:panel style="text-align:right; border-color: white;" >
             <h:panelGroup>
             <a4j:commandButton value="Save" id="saveButton" reRender="datatable, dialog, messages" action="#{controller.saveSelectedEntity}"/>
             </h:panelGroup>
             </rich:panel>
            
             </rich:panel>
             </h:panelGroup>
             </div>
             </a4j:outputPanel>
             </h:form>


            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
              John Doe Newbie

              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
                Ilya Shaikovsky Master

                make the links in dataTAble ajaxSingle.

                • 5. Re: a4j:support Troubles
                  John Doe Newbie

                  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
                    Nick Belaevski Master

                    Hi,

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