3 Replies Latest reply on Sep 17, 2008 7:29 AM by Ilya Shaikovsky

    should modalPanel cause a postback onshow

    Alex Newbie

      Hello,

      I noticed that on the live demo when I open a modal panel, no postback (as in ajax request) is made. On my application, I have tried both ways of showing a modal panel, but it still causes an ajax request. Any idea in what cases it could cause a postback?
      Thanks

        • 1. Re: should modalPanel cause a postback onshow
          Ilya Shaikovsky Master

          show your code please. probable you using some a4j: or h: command components to use the modal.

          • 2. Re: should modalPanel cause a postback onshow
            Alex Newbie

            Here is my modal Panel:

             <f:subview id="loginsubview" >
             <rich:modalPanel id="loginModal" height="150" width="350" minWidth="350">
             <f:facet name="header">
             <h:outputText value="Login Window" />
             </f:facet>
             <f:facet name="controls">
             <h:graphicImage value="/images/close.png" style="cursor:pointer" onclick="Richfaces.hideModalPanel('loginModal')" />
             </f:facet>
             <a4j:form id="loginform" ajaxSubmit="true">
             <div align="center">
             <h:outputText value="#{messages.pleaseLogin}" style="text-align: center; width: 100%;" />
             </div>
             <a4j:region renderRegionOnly="false">
             <div align="center">
             <h:panelGrid columns="2" rowClasses="prop" columnClasses="name,value">
             <h:outputLabel for="username" value="#{messages.Username}"></h:outputLabel>
             <h:inputText id="username"
             value="#{Authentificator.username}"
             styleClass="rd-pnl-txt" style="background-color:#D1E8D1;"
             onblur="this.style.margin = '1px'; this.style.borderWidth = '1px'; this.style.backgroundColor = '#D1E8D1';"
             onfocus="this.style.margin = '0'; this.style.borderWidth = '2px'; this.style.backgroundColor = '#FFFFFF';">
            
             </h:inputText>
             <h:outputLabel for="password" value="#{messages.Password}"></h:outputLabel>
             <h:inputSecret id="password"
             value="#{Authentificator.password}"
             styleClass="rd-pnl-txt" style="background-color:#D1E8D1;"
             onblur="this.style.margin = '1px'; this.style.borderWidth = '1px'; this.style.backgroundColor = '#D1E8D1';"
             onfocus="this.style.margin = '0'; this.style.borderWidth = '2px'; this.style.backgroundColor = '#FFFFFF';">
            
             </h:inputSecret>
             </h:panelGrid>
             </div>
            
             <div align="center">
             <a4j:commandButton value="Login" action="#{Authentificator.login}" id="loginModalButton"
             reRender="topmenupanel,rightmenupanel,indexmessages,wstablepanel,auxiliarmenupanel" styleClass="dr-pbl-bnt"
             status="progressMain"/>
             <rich:componentControl for="loginsubview:loginModal" attachTo="loginModalButton"
             operation="hide" event="onclick"/>
             </div>
             </a4j:region>
             </a4j:form>
             </rich:modalPanel>
            </f:subview>
            


            This is used to show the modal panel.

            <f:view>
             // ............
            <a4j:form id="topmenuform">
             <a4j:outputPanel layout="none" id="topmenupanel">
             <div class="header">
             <h1><a href="#">huddi</a></h1>
             <h2>
             <h:outputText value="human uddi - #{messages.wssc}" />
             </h2>
             <div style="width: 100%;" id="uplinks">
             <table width="100%">
             <tr>
             <td align="left" width="75%;">
             <h:commandLink value="RO " action="#{LocaleSelector.setLocaleRo}" />
             <h:commandLink value=" EN" action="#{LocaleSelector.setLocaleEn}" />
             </td>
             <td align="right" width="20%">
             <a4j:commandLink id="logincommand" value="#{messages.Login} " rendered="#{!Authentificator.authentificated}"
             status="progressMain"/>
             <rich:componentControl for="loginsubview:loginModal" attachTo="logincommand" operation="show" event="onclick" params="top: 75, left: window.innerWidth - 410"/>
             <h:outputText id="welcometext" value="#{messages.Welcome}, #{Authentificator.username} "
             rendered="#{Authentificator.authentificated}" style="color: white;"/>
             </td>
             <td align="right" width="10">
             <div align="center">
             <p style="color: white;">|</p>
             </div>
             </td>
             <td align="left" width="30">
             <h:outputLink id="registerlink" value="/huddi/pages/register.jsf" rendered="#{!Authentificator.authentificated}" >
             <h:outputText value=" #{messages.register_register}" />
             </h:outputLink>
            
             <a4j:commandLink id="logoutcommand" value="#{messages.Logout}" action="#{Authentificator.logout}"
             rendered="#{Authentificator.authentificated}" reRender="topmenupanel" status="progressMain"/>
             </td>
             </tr>
             </table>
             </div>
             </div>
             </a4j:outputPanel>
             </a4j:form>
            <f:view>
            


            • 3. Re: should modalPanel cause a postback onshow
              Ilya Shaikovsky Master

              so you using a4j:command to show/close the panel this will cause the request for sure.

              use just h:outputLink as it shown in demo.

              and this is not about it but do not use ajaxSubmit="true" without nessesity on the form. You already use a4j:command controls. So this attribute usage not nessesary.