14 Replies Latest reply on Feb 18, 2008 4:09 AM by mail.micke

    Parse Error: modalpanel rerendering

    mail.micke

      Hi,
      I'm getting a Parse Error in the a4j:log window when trying to call a backing bean and then rerender content in the modal panel.

      The modal panel is defined outside of any other forms and has its own form as a child.

      Using:
      RichFaces 3.1.4.GA
      Seam 2.0.1.GA

      Modal panel definition:

      <rich:modalPanel
       id="cptySearchMp"
       minHeight="200"
       minWidth="450"
       height="200"
       width="500"
       zindex="2000">
       <f:facet name="header">
       <h:outputText value="Search For Counterparty" />
       </f:facet>
       <f:facet name="controls">
       <a href="javascript:Richfaces.hideModalPanel('cptySearchMp')">Close</a>
       </f:facet>
      
       <a4j:include viewId="/jsf/favourite/cptySearch.xhtml"/>
       </rich:modalPanel>
      


      cptySearch.xhtml
      <ui:composition
       xmlns="http://www.w3.org/1999/xhtml"
       xmlns:ui="http://java.sun.com/jsf/facelets"
       xmlns:h="http://java.sun.com/jsf/html"
       xmlns:f="http://java.sun.com/jsf/core"
       xmlns:rich="http://richfaces.ajax4jsf.org/rich"
       xmlns:a4j="http://richfaces.org/a4j"
       xmlns:s="http://jboss.com/products/seam/taglib"
       xmlns:lcf="http://limex.dkib.com/func">
      
       <h:form id="cptySearchForm">
      
       Search pattern: <h:inputText value="#{cptySearch.pattern}"/>
      
       <a4j:commandLink action="#{cptySearch.search}" value="Search" reRender="tableWrapper"/>
       <a4j:status startText="Working..." stopText=""/>
      
       <br/>
      
       <a4j:outputPanel layout="none" id="tableWrapper">
       <rich:dataTable
       id="searchResult"
       rendered="#{not empty cptySearch.result}"
       value="#{cptySearch.result}"
       var="row"
       rows="10"
       width="400px">
      
       <f:facet name="header">
       <rich:datascroller for="searchResult"/>
       </f:facet>
      
       <rich:column>
       <f:facet name="header">
       Code
       </f:facet>
       #{row.code}
       </rich:column>
       <rich:column>
       <f:facet name="header">
       Name
       </f:facet>
       #{row.name}
       </rich:column>
       <rich:column>
       <f:facet name="header">
       Action
       </f:facet>
       <h:commandLink value="Add" action="#{favBacking.addFavourite(row.code)}"/>
       </rich:column>
       </rich:dataTable>
       </a4j:outputPanel>
      
       <rich:messages showDetail="true"/>
       </h:form>
      </ui:composition>
      


      a4j:log output:
      debug[17:18:20,080]: Header Ajax-Expired not found, search in <meta>
      error[17:18:20,080]: Error parsing XML
      error[17:18:20,095]: Parse Error: XML Parsing Error: Whitespace is not allowed at this location.
      Location: Line Number 7, Column 123:
      <script type="text/javascript" language="Javascript">function dpf(f) {var adp = f.adp;if (adp != null) {for (var i = 0;i < adp.length;i++) {f.removeChild(adp);}}};function apf(f, pvp) {var adp = new Array();f.adp = adp;var ps = pvp.split(',');for (var i = 0,ii = 0;i < ps.length;i++,ii++) {var p = document.createElement("input");p.type = "hidden";p.name = ps;p.value = ps[i + 1];f.appendChild(p);adp[ii] = p;i += 1;}};function jsfcljs(f, pvp, t) {apf(f, pvp);var ft = f.target;if (t) {f.target = t;}f.submit();f.target = ft;dpf(f);};</script>
      ---------------------------------------------------------------------------------------------------------------------------^
      debug[17:18:20,095]: call selectSingleNode for id= org.ajax4jsf.oncomplete
      



        • 1. Re: Parse Error: modalpanel rerendering

          See
          http://www.jboss.org/index.html?module=bb&op=viewtopic&t=121719

          Here we talk about reRender modal panels, known bugs and YOU said, that layout="inline" works :-) Perhaps it helps you now...

          • 2. Re: Parse Error: modalpanel rerendering
            mail.micke

            Hiya

            Yeah I've reRendered modalpanels before :), but that has been the case of submitting an ajax request and on complete displaying the reRendered modal panel.

            In this case I want to pop-up a modal panel with an input box for searching, do the search and display the result (reRender an inline wrapper around a table).
            So I wish to reRender the content in the modal panel after it has been displayed.

            What happens is that the backing bean action is executed ok, the response seems to come back, but then there is that Parse Error in the a4j:log output :(

            Any ideas?

            Thanks,
            Micke

            • 3. Re: Parse Error: modalpanel rerendering
              ilya_shaikovsky

              Could you please share sample(with libs and sources) in order to just import and investigate?

              • 4. Re: Parse Error: modalpanel rerendering
                mail.micke

                Will try and put something together soon, might take a day or two, currently ill and I need to create a new project for this.

                • 5. Re: Parse Error: modalpanel rerendering

                  i have the same problem: The modal panel is defined outside trigger: richfaces component. the modal panel can not be rerendered.
                  configuration: richfaces 3.2.0-snapshot and facelets1.1.12
                  modal panel

                  <ui:composition>
                   <rich:modalPanel id="PropertiesModalPanel" width="400" height="500" zindex="2000">
                   <f:facet name="header">
                   Details
                   </f:facet>
                   <f:facet name="controls">
                   <a href="#" onclick="Richfaces.hideModalPanel('PropertiesModalPanel')">X</a>
                   </f:facet>
                   <a4j:outputPanel id="modalContent" layout="none">
                   <h:form id="propertiesForm1" >
                   <div align="center">
                   <ui:insert name="PropertiesPanelbarModalPanel" />
                   </div>
                   </h:form>
                   </a4j:outputPanel>
                   </rich:modalPanel>
                  </ui:composition>
                  


                  trigger of the modalpanel
                   <rich:contextMenu id="contextMenuId" event="oncontextmenu" attached="true" submitMode="ajax" >
                  
                   <rich:menuItem id="properties" value="Show Property" submitMode="ajax"
                   reRender="detailsMp,modalContent,common_modalpanel,panelbar,Main_TabPanel2"
                   actionListener="#{ctrl.deviceSelected}"
                   oncomplete="Richfaces.showModalPanel('detailsMp')" >
                   <f:param name="devicePhysName" value="#{item.dataItem.physName}" />
                   <f:param name="itemName" value="properties"/>
                   </rich:menuItem>
                  </rich:contextMenu>
                  



                  • 6. Re: Parse Error: modalpanel rerendering
                    mail.micke

                    Hi darmstadter

                    Correct me if I'm wrong here. You are 1) updating the modal panel content, 2) Displaying the modal panel with the updated content. Right.

                    That is a bit different from what I'm trying to do, and what you are doing should work fine. I've done it, just not with a rich:menuItem.

                    Have you tried adding a a4j:log component? Then you can see what is actually going on with the ajax stuff on the client side (what is the response,any errors, etc), could help you out.


                    Good luck ;)

                    • 7. Re: Parse Error: modalpanel rerendering

                      thanks a lot for your answers. You are correct, what i am going to do. My problem is not be solved. when i put the modal panel in trigger file, it works fine. Only defined outside there is problem. i don't know, it is a bug of richfaces or others. I will add a4j:log. Thanks again.

                      • 8. Re: Parse Error: modalpanel rerendering
                        mail.micke

                        A while ago I created a wiki page in the RichFacesCookbook about showing a "detail view" modal panel.

                        http://labs.jboss.com/wiki/en//RichFacesCookbook/DetailModalPanelFromTable

                        I'm not quite sure what you mean by "trigger" would that be the same as what is done in the cookbook example's "Show" link; triggering an update of the modal panels content?

                        • 9. Re: Parse Error: modalpanel rerendering

                          yes, you are correct, the trigger is a contextmenu item. it triggt an update of the modal panel and show the modal panel.

                          • 10. Re: Parse Error: modalpanel rerendering

                            i have tested with the wiki page, it works fine. But the problem is, if the modal panel is not with the datatable together. it can not be updated.

                            • 11. Re: Parse Error: modalpanel rerendering
                              mail.micke

                              Have you tried adding the a4j:log?
                              It might produce some logging information that might help the devs troubleshoot this.

                              So what you've experienced is that if you define the modalpanel in another file which is included in the file that has the trigger, it doesn't work. Good to know.

                              Cheers

                              • 12. Re: Parse Error: modalpanel rerendering
                                mail.micke

                                Hi Ilya

                                I've created an example project which has the parse error problem, tried to send it to the email address in your profile which didn't work.

                                Where would you like me to send it?

                                Cheers

                                • 13. Re: Parse Error: modalpanel rerendering
                                  ilya_shaikovsky

                                  create please jira issue, attach example and describe steps to reproduce. It will be faster.

                                  • 14. Re: Parse Error: modalpanel rerendering
                                    mail.micke

                                    Done.

                                    http://jira.jboss.com/jira/browse/RF-2275

                                    I'm not 100% sure this is a RF bug, could be something I've done incorrectly (for example the modal panel won't pop-up for me in firefox...).

                                    Cheers