0 Replies Latest reply on Jul 7, 2007 8:45 AM by thiagu.m

    problem with modal panel forms

      Hi every one, in my work i have one doubt, any one give right solution
      in my page i have two links, one for login and another one for registration.
      each links open a separate modal panel. i put separate form form on each modal panel and also i display the validation error message on modal panel.
      in this case when i submit the first form (when i login) i got the second form validation error message (registration page error message)on my login modal panel. i think this two form are treated as nested form.
      so when i submit my first login form i got the validation error of my second form.
      and also i need to clearer my all error messages when i close my modal panel.
      How to resolve this problem,
      Please any one help me
      i give my sample code here

      <script>
       function windowclose(){
       if ((document.getElementById('lo_form:error')==null)){
       Richfaces.hideModalPanel('register');
       };
       };
      function windowclose1(){
       if ((document.getElementById(re_form:error1')==null)){
       Richfaces.hideModalPanel('register');
       };
       };
      
      </script>
      <a href="javascript:Richfaces.showModalPanel('login',{width:450, top:200})">Login</a>
      <a href="javascript:Richfaces.showModalPanel('register',{width:450, top:200})">Register</a>
      
       <rich:modalPanel id="login" height="270" width="500" zindex="2000">
      
       <p>Please login using any username and password</p>
       <a:form id="lo_form">
       <s:decorate id="IdDecorate" template="edit.xhtml">
       <ui:define name="label">Username:</ui:define>
       <h:inputText id="Id" value="#{identity.username}" required="true">
       <a:support event="onblur" reRender="IdDecorate"/>
       </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" required="true">
       <a:support event="onblur" reRender="passwordDecorate"/>
       </h:inputSecret>
       </s:decorate>
      
       <a:outputPanel ajaxRendered="true">
       <h:messages id="error"/>
       </a:outputPanel>
      
       <a:commandButton value="Login" type="submit" oncomplete="windowclose(); " action="#{identity.login}" />
       </a:form>
       </rich:modalPanel>
      ---------------------------------------
      <rich:modalPanel id="register" height="270" width="500" zindex="2000">
      
       <p>Please Enter your Details</p>
       <a:form id="re_form">
       <s:decorate id="IdDecorate" template="edit.xhtml">
       <ui:define name="label">Username:</ui:define>
       <h:inputText id="Id" value="#{user.username}" required="true">
       <a:support event="onblur" reRender="IdDecorate"/>
       </h:inputText>
       </s:decorate>
      
       <s:decorate id="passwordDecorate" template="edit.xhtml">
       <ui:define name="label">Password:</ui:define>
       <h:inputSecret id="password" value="#{user.password}" redisplay="true" required="true">
       <a:support event="onblur" reRender="passwordDecorate"/>
       </h:inputSecret>
       </s:decorate>
      
       <s:decorate id="nameDecorate" template="edit.xhtml">
       <ui:define name="label">Real Name:</ui:define>
       <h:inputSecret id="password" value="#{user.name}" redisplay="true" required="true">
       <a:support event="onblur" reRender="nameDecorate"/>
       </h:inputSecret>
       </s:decorate>
      
       <a:outputPanel ajaxRendered="true">
       <h:messages id="error1"/>
       </a:outputPanel>
      
       <a:commandButton value="Register" type="submit" oncomplete="windowclose1(); " action="#{register.action}" />
       </a:form>
       </rich:modalPanel>