1 Reply Latest reply on Jul 5, 2007 8:41 AM by Ilya Shaikovsky

    How to reload the Parent form

    Thiagu Mariappan Novice

      i want to display user name no Parent form get from child form(modal panel). i meant to display the user name on main page get from modal panel.
      in my modal panel i validate the user name and display the error message on the modal panel, when user click submit button on the modal panel, the user name will going to display the the main page if it is valid.
      in this case when the child form submitted the main form will not get refreshed, so after submit my child form i need to reload the main page for displaying user name no the main page

      i give my sample code here, any one help me

       <script type="text/javascript">
       function windowclose(){
       if (document.getElementById('mpform:error')==null){
      
       Richfaces.hideModalPanel('login');
       submit();
      
       };
       };
      </script>
      <h:form>
      <h:commandButton value="Login" type="button" onclick="javascript:Richfaces.showModalPanel('login',{left:'auto', top:'auto'})" rendered="#{not identity.loggedIn} />
      <h:outputText value="Welcome, #{identity.username}" rendered="#{identity.loggedIn} />
      <h:form>
      <rich:modalPanel moveable="false" resizeable="false" id="login" height="270" width="500" zindex="2000">
      
       <f:facet name="header">
       <h:outputText value="Login Form" />
       </f:facet>
       <f:facet name="controls">
       <a href="javascript:Richfaces.hideModalPanel('login')">X</a>
       </f:facet>
      
       <p>Please login using any username and password</p>
       <a:form id="mpform">
       <div class="dialog">
      
       <s:decorate id="siIdDecorate" template="edit.xhtml">
      
      
       <ui:define name="label">Username:</ui:define>
      
       <h:inputText id="siId" value="#{identity.username}" >
      
       <a:support event="onblur" reRender="siIdDecorate"/>
      
       </h:inputText>
      
       </s:decorate>
      
       <s:decorate id="passwordDecorate" template="edit.xhtml">
      
       <ui:define name="label">Password:</ui:define>
      
       <h:inputSecret id="password" value="#{identity.password}" redisplay="true">
       <a:support event="onblur" reRender="passwordDecorate"/>
      
       </h:inputSecret>
      
       </s:decorate>
      
       <s:decorate id="rememberDecorate" template="edit.xhtml">
      
       <ui:define name="label">Remember me</ui:define>
       <h:selectBooleanCheckbox id="rememberMe" value="#{identity.rememberMe}"/>
       </s:decorate>
      
      
       <div class="actionButtons">
       <a:outputPanel ajaxRendered="true">
       <h:messages id="error"/>
       </a:outputPanel>
      
       <a:commandButton value="Login" type="submit" oncomplete="windowclose(); " action="#{identity.login}" /> 
       <a:commandButton value="Cancel" immediate="true" onclick="javascript:Richfaces.hideModalPanel('login')"/>
       </div>
       </div>
      </a:form>
      
      
       </rich:modalPanel>