5 Replies Latest reply on Oct 2, 2007 3:45 AM by ilya_shaikovsky

    richfaces 3.1.1 and problems

    ivan.tufegdzic

      Hi,
      I changed version richfaces and ajax on last update version.
      On modal panel I have problem with action in modal panel (eq. action button in modal panel doesnt work, only would be closed mp without action).
      In early version all works fine (same code), but now action works only with s:link.
      Any ideas?

      And I have one question.If exist any possibility to dynamically fetching of rows from the server when a table is scrolled left and right (I think on rich:datascroller),how to do?

      Thanks
      it

        • 1. Re: richfaces 3.1.1 and problems

          please post a code snippet.

          what was your previous version (3.0.1 or 3.1.1) before you upgrade?

          • 2. Re: richfaces 3.1.1 and problems
            ilya_shaikovsky

            About modal panel - probably your earlier version is 3.0.1 or lower.. There are some differences from those versions.

            One of them:
            1) You should use form inside your modal panel to perform submit.
            2) In case when you have 1) - your modal panel - shouldn't be inside another external form.

            • 3. Re: richfaces 3.1.1 and problems
              ivan.tufegdzic

              I had version 3.0.1.

              This is template.xhtml

              <html xmlns="http://www.w3.org/1999/xhtml"
               xmlns:ui="http://java.sun.com/jsf/facelets"
               xmlns:h="http://java.sun.com/jsf/html"
               xmlns:t="http://myfaces.apache.org/tomahawk"
               xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
               xmlns:lmg="http://www.livemediagroup.de/jsf"
               xmlns:rich="http://richfaces.ajax4jsf.org/rich"
               xmlns:f="http://java.sun.com/jsf/core"
               xmlns:s="http://jboss.com/products/seam/taglib">
              <head>
              <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
              <link href="#{navigationHandler.basePath}/skin/default.css"
               rel="stylesheet" type="text/css" />
              <script type="text/javascript"
               src="#{navigationHandler.basePath}/js/picklist.js"><!-- --></script>
              <script type="text/javascript"
               src="#{navigationHandler.basePath}/js/ie.js"><!-- --></script>
              </head>
              
              <body>
              <div class="topleft" id="headerline">
              <div />
              </div>
              <div class="topleft" id="logo">
              <div />
              </div>
              <div style="height: 95px;" />
              <h:graphicImage value="/images/blank.gif" height="5" />
              <div class="body"><ui:insert name="body" /></div>
              <rich:modalPanel id="mp" minHeight="200" minWidth="450" height="300"
               width="500" zindex="2000">
               <f:facet name="header">
               <h:outputText value="Bearbeitungsdialog" />
               </f:facet>
               <f:facet name="controls">
               <h:graphicImage value="/images/stock_exit.gif" style="cursor:pointer"
               onclick="Richfaces.hideModalPanel('mp')" />
               </f:facet>
               <h:form id="mpform">
               <a4j:outputPanel ajaxRendered="true">
               <h:messages id="error"></h:messages>
               </a4j:outputPanel>
               <ui:insert name="wizard"></ui:insert>
               </h:form>
              </rich:modalPanel>
              </body>
              </html>
              
              


              page.xhtml

              <ui:composition xmlns="http://www.w3.org/1999/xhtml"
               xmlns:s="http://jboss.com/products/seam/taglib"
               xmlns:ui="http://java.sun.com/jsf/facelets"
               xmlns:lmg="http://www.livemediagroup.de/jsf"
               xmlns:f="http://java.sun.com/jsf/core"
               xmlns:h="http://java.sun.com/jsf/html"
               xmlns:t="http://myfaces.apache.org/tomahawk"
               xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
               xmlns:rich="http://richfaces.ajax4jsf.org/rich"
               xmlns:c="http://java.sun.com/jstl/core"
               template="/layout/admintemplate.xhtml">
               <ui:define name="wizard">
               <a4j:include ajaxRendered="true"
               viewId="/questionaire/admin/template/questionaire_dlg.xhtml"></a4j:include>
               </ui:define>
              <ui:define name="body">
               <a4j:form id="myform">
              ...
              <a4j:commandLink value="#{messages.send}" onclick="if(!confirm('#{messages.text5}'))return false"
               action="#{adminQuestionaireHandler.prepareToSendQuestionaire}" reRender="mp"
               oncomplete="Richfaces.showModalPanel('mp',{width:500,height:500,top:50})"></a4j:commandLink> </a4j:form>
               </ui:define>
              </ui:composition>
              
              


              questionaire_dlg.xhtml

              <a4j:form xmlns:ui="http://java.sun.com/jsf/facelets"
               xmlns:s="http://jboss.com/products/seam/taglib"
               xmlns:f="http://java.sun.com/jsf/core"
               xmlns:h="http://java.sun.com/jsf/html"
               xmlns:t="http://myfaces.apache.org/tomahawk"
               xmlns:lmg="http://www.livemediagroup.de/jsf"
               xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
               xmlns:rich="http://richfaces.ajax4jsf.org/rich">
               <a4j:region>
               <rich:panel
               rendered="#{not empty currentQuestionaire and not empty currentUser}">
               <t:panelGrid columns="2">
               <t:outputText value="#{messages.name}" />
               <t:inputText value="#{currentUser.name}" required="true" />
               <t:outputText value="#{messages.email}" required="true" >
               </t:outputText>
               <t:inputText value="#{currentUser.email}" required="true">
               <f:validator validatorId="com.elbsolutions.EmailValidator" />
               </t:inputText>
               </t:panelGrid>
              
               <rich:panel>
               <h:panelGroup rendered="#{roleHandler.admin}">
              
               <s:decorate template="/layout/edit.xhtml">
               <ui:define name="label">#{messages.expiredate}</ui:define>
               <h:inputText id="expire" required="true"
               value="#{adminQuestionaireHandler.expireDate}">
               <s:convertDateTime pattern="MM/dd/yyyy" />
               </h:inputText>
              
               <s:selectDate for="expire" startYear="2007" endYear="2300">
               <rich:spacer width="5"></rich:spacer>
               <t:graphicImage value="/images/datepicker.gif" />
               </s:selectDate>
              
               </s:decorate>
               </h:panelGroup>
              
               </rich:panel>
              
               <a4j:commandButton value="#{messages.cancel}" immediate="true"
               reRender="mp" oncomplete="windowclose();"
               action="#{actionBean.cancelSending}" />
               <a4j:commandButton value="#{messages.send}"
               rendered="#{roleHandler.admin}"
               action="#{actionBean.sendQuestionaire}"
               oncomplete="windowclose();"/>
              
               />
               </rich:panel>
               </a4j:region>
              </a4j:form>
              


              ActionBean.java

              ...
              @Begin(join=true)
               public String sendQuestionaire() {
               if ((currentUser=questionaireXService.sendQuestionaire(currentUser, currentQuestionaire, expireDate))!=null) {
               mailAction.sendMail(currentUser);
               FacesMessages.instance().add("Questionaire wurde zu geschickt "+currentUser.getEmail());
               } else {
               FacesMessages.instance().add(currentUser.getEmail()+" hat bereits dieses questionaire");
               }
               currentUser=null;
               expireDate=null;
               return "/questionaire/admin/template/templatedetails.xhtml";
               }
              ...
              



              windowclose() is JS for checking errors in mp and closing mp if mp haven't errors.
              Clicking on button send in mp, nothing happens (no submiting and no entering in function, only closing mp).

              • 4. Re: richfaces 3.1.1 and problems
                ivan.tufegdzic

                One error in writing.I tried to resolve and changed on form (instead composition), and removed form from template, but no success.

                questionaire_dlg.xhtml

                <ui:compositionxmlns:ui="http://java.sun.com/jsf/facelets"
                 xmlns:s="http://jboss.com/products/seam/taglib"
                 xmlns:f="http://java.sun.com/jsf/core"
                 xmlns:h="http://java.sun.com/jsf/html"
                 xmlns:t="http://myfaces.apache.org/tomahawk"
                 xmlns:lmg="http://www.livemediagroup.de/jsf"
                 xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
                 xmlns:rich="http://richfaces.ajax4jsf.org/rich">
                 <a4j:region>
                 <rich:panel
                 rendered="#{not empty currentQuestionaire and not empty currentUser}">
                 <t:panelGrid columns="2">
                 <t:outputText value="#{messages.name}" />
                 <t:inputText value="#{currentUser.name}" required="true" />
                 <t:outputText value="#{messages.email}" required="true" >
                 </t:outputText>
                 <t:inputText value="#{currentUser.email}" required="true">
                 <f:validator validatorId="com.elbsolutions.EmailValidator" />
                 </t:inputText>
                 </t:panelGrid>
                
                 <rich:panel>
                 <h:panelGroup rendered="#{roleHandler.admin}">
                
                 <s:decorate template="/layout/edit.xhtml">
                 <ui:define name="label">#{messages.expiredate}</ui:define>
                 <h:inputText id="expire" required="true"
                 value="#{adminQuestionaireHandler.expireDate}">
                 <s:convertDateTime pattern="MM/dd/yyyy" />
                 </h:inputText>
                
                 <s:selectDate for="expire" startYear="2007" endYear="2300">
                 <rich:spacer width="5"></rich:spacer>
                 <t:graphicImage value="/images/datepicker.gif" />
                 </s:selectDate>
                
                 </s:decorate>
                 </h:panelGroup>
                
                 </rich:panel>
                
                 <a4j:commandButton value="#{messages.cancel}" immediate="true"
                 reRender="mp" oncomplete="windowclose();"
                 action="#{actionBean.cancelSending}" />
                 <a4j:commandButton value="#{messages.send}"
                 rendered="#{roleHandler.admin}"
                 action="#{actionBean.sendQuestionaire}"
                 oncomplete="windowclose();"/>
                
                 />
                 </rich:panel>
                 </a4j:region>
                </ui:composition>
                
                


                • 5. Re: richfaces 3.1.1 and problems
                  ilya_shaikovsky

                  As I told you:

                  You have a form around MP and inside. But nested forms not allowed.

                  So you need to use a form inside MP and remove form outside.

                  and do not use rerendering whole MP - reRender its content.