4 Replies Latest reply on Jul 10, 2009 9:21 AM by tim.kaufner

    Curious problem on ajax-request (rerender problem)

      Hi guys, I'm facing a curious problem on sending an ajax-request...
      I have a "search-component" which is being rendered on two different jspx-sites.
      This search-component opens a modal panel when a user clicks on a button. Here is the code that should open the panel (part of "input.jspx", defined in facelet-taglib). The code below is being shortened to relevant stuff...

      <a4j:commandButton id="openPanel_#{panelId}" reRender="searchObjectPage_#{panelId}" action="#{searchBean.show}" oncomplete="Richfaces.showModalPanel('searchObjectPanel_#{panelId}')" image="images/button/search.gif" immediate="true">
       <a4j:actionparam name="#{applicationScope.constants.REQUEST_SEARCHFOR}" value="#{property.searchFor}" assignTo="#{searchBean.searchFor}" />
      </a4j:commandButton>
      
      <a4j:outputPanel id="outPanel_#{panelId}">
       <rich:modalPanel id="searchObjectPanel_#{panelId}" zindex="2000" width="800" height="600" moveable="true" autosized="true" showWhenRendered="false">
       <a4j:include viewId="/search.jspx" id="searchObjectPage_#{panelId}"/>
       </rich:modalPanel>
      </a4j:outputPanel>




      On both sites (named: "simple.jspx" and "details.jspx") the above page "input.jspx" is included with a custom tag.

      Extract from "details.jspx":

      <a4j:form id="detailsform">
      ......
      <mytag:input property="#{property.current}"/>
      ......
      </a4j:form>
      




      Extract from "simple.jspx":
      <a4j:form id="simpleform">
      ......
      <mytag:input property="#{property.current}"/>
      ......
      </a4j:form>
      




      Extract from "search.jspx" which should be rerendered on ajax-request:

      <a4j:region>
       <rich:panel id="searchPanel" bodyClass="searchPanel">
       <rich:dataTable id="searchTable" value="#{searchBean.entries}" var="entry" rows="10"
       ...
       </rich:dataTable>
       </rich:panel>
      </a4j:region>




      As you can see the code for "simple.jspx" and "details.jspx" is nearly the same, except for the different ids for the forms...
      The code (that is being rendered before button pressed looks like:

      "simple.jspx"

      <input id="simpleform:openPanel_username_searchPanel" name="simpleform:openPanel_username_searchPanel" onclick="A4J.AJAX.Submit('_viewRoot','simpleform',event,{'oncomplete':function(request,event,data){Richfaces.showModalPanel('searchObjectPanel_username_searchPanel')},'similarityGroupingId':'simpleform:openPanel_username_searchPanel','parameters':{'searchFor':'username','actionUrl':'/dpt/datalist.jsf'} );return false;" type="image" src="images/button/search.gif" />




      "details.jspx"
      <input id="detailsform:openPanel_username_searchPanel" name="detailsform:openPanel_username_searchPanel" onclick="A4J.AJAX.Submit('_viewRoot','detailsform',event,{'oncomplete':function(request,event,data){Richfaces.showModalPanel('searchObjectPanel_username_searchPanel')},'similarityGroupingId':'detailsform:openPanel_username_searchPanel','parameters':{'searchFor':'username','actionUrl':'/dpt/details.jsf'} );return false;" type="image" src="images/button/search.gif" />
      




      The workflow should be the following: The user clicks on the command-button, the request (with some parameters) is being sent to the server (searchbean is a session-bean). After the request is done, the panel with id ="searchObjectPage_#{panelId}" is being rerendered and after that shown with the oncomplete-function. All this works fine for my first jspx-site ("details.jspx"). But on the second jspx-site the rerender is totally being ignored as a4j:log says.


      Here is the log for the first site (which is being rendered correctly, modal panel opens and the elements in there are being rerendered):

      debug[11:11:49,109]: Update part of page for Id: detailsform:searchObjectPage_username_searchPanel:searchTable:j_id483header:sortDiv successful
      debug[11:11:49,109]: Update page part from call parameter for ID detailsform:searchObjectPage_username_searchPanel:searchTable:j_id489header:sortDiv
      debug[11:11:49,109]: call selectSingleNode for id= detailsform:searchObjectPage_username_searchPanel:searchTable:j_id489header:sortDiv
      




      That`s the log from the second-site (modal panel is shown but no elements in there are being rerendered):

      debug[11:13:29,281]: Find <meta name='Ajax-Update-Ids' content=''>
      debug[11:13:29,281]: Find <meta name='Ajax-Response' content='true'>
      debug[11:13:29,281]: Header Ajax-Update-Ids not found, search in <meta>
      debug[11:13:29,281]: search for elements by name 'meta' in element #document
      debug[11:13:29,281]: Find <meta name='Ajax-Update-Ids' content=''>
      warn[11:13:29,281]: No information in response about elements to replace
      debug[11:13:29,281]: call selectSingleNode for id= org.ajax4jsf.oncomplete
      debug[11:13:29,281]: Processing updates finished, no oncomplete function to call



      Just figured out that the action (defined on action-attribute action="#{searchBean.show}" is not being invoked on the second page ("simple.jspx"). This must be the bug that causes no rerender... But why is the action not being called?
      I would be much appreciated if anybody has a solution :)