3 Replies Latest reply on Jul 2, 2009 7:38 AM by praveen jain

    problem getting value from model panel

    praveen jain Novice

      hi
      i have a page in which i defined a modal panel in a seprate
      in that modelpanel i have many link every link used to open another modelpanel which contain two fields for username and password, and both fields are bind with beans.
      when i press ok button on second model panel the function that i write in action tag is executed but i dint get the value of user/password filed in the beans.

      how can i get value in beans. this is mu comand button

      <a4j:commandButton value="OK"
       action="#{mainBind.customWizard.lanBrowser.reGenerateLan}"
       oncomplete="Richfaces.hideModalPanel('lanLoginDialog');"
       styleClass="CommandButton" reRender="lanBrowser" />


      i tried with type=submit" but no use.

        • 1. Re: problem getting value from model panel
          Ilya Shaikovsky Master

          read about modal panel restrictions related to form usage in dev guide.

          • 2. Re: problem getting value from model panel
            praveen jain Novice

            yes i read the doc for model panel, but there is no
            restriction for model panel inside model panel.

            • 3. Re: problem getting value from model panel
              praveen jain Novice

              here is my code which is not working properly
              as i am unable to get values from modal panale inside mosal panel

              This is my first page , which open a modalPanal "PanelWaizard"

              <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
              <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
              <%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
              <%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
              <%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
              <html>
              <head>
              <title>Management Console</title>
              
              </head>
              <body>
              
              
              <f:view>
               <rich:modalPanel id="panelWizard" width="550" height="389"
               styleClass="wizardModalPanel" resizeable="false">
              
               <f:facet name="header">
               <h:panelGroup>
               <h:outputText value="modal panel test"></h:outputText>
               </h:panelGroup>
               </f:facet>
               <f:facet name="controls">
               <h:panelGroup>
               <h:graphicImage value="/images/modal/close.png"
               style="cursor:pointer" id="hideWizard" alt="Close" />
               <rich:componentControl for="panelWizard" attachTo="hideWizard"
               operation="hide" event="onclick" />
               </h:panelGroup>
               </f:facet>
               <h:form id="frmDialog">
               <jsp:include page="Wizard.jsp" />
               </h:form>
               </rich:modalPanel>
              
              
              
               <!--Refresh Tree Modal Panel end-->
              
               <table width="100%">
               <tr>
               <td style="background-color: #DDDDDD"></td>
               <td width="900"><h:form id="formMain">
              
              
               <rich:tabPanel id="mainTabs" switchType="client"
               selectedTab="tabHome" styleClass="mainTabPanel"
               activeTabClass="mainTabPanelActive"
               inactiveTabClass="mainTabPanelInactive"
               disabledTabClass="mainTabPanelDisabled"
               style="padding: 0px; margin: 0px;"
               contentClass="mainTabContentClass">
               <rich:tab id="tabHome" label="Home">
               <t:panelGrid columns="3">
               <t:column>
               <a4j:outputPanel style="width: 62px;" styleClass="groupNormal"
               layout="block">
               <a4j:outputPanel layout="block" styleClass="groupRight">
               <a4j:outputPanel layout="block" styleClass="groupLeft">
               <t:panelGrid columns="1">
               <t:column>
               <a4j:outputPanel layout="block" id="btnTabHome"
               styleClass="buttonNormal" style="width:55px;">
               <a4j:outputPanel layout="block" styleClass="leftsite">
               <a4j:outputPanel layout="block" styleClass="rightsite">
               <t:graphicImage alt="Home"
               value="/images/GridBank/Folders/gridbank/png/gridbank_32.png" />
               <br />
               <h:outputText value="Home" />
               </a4j:outputPanel>
               </a4j:outputPanel>
              
               <a4j:support event="onclick"
              
               oncomplete="Richfaces.showModalPanel('panelWizard');"
               reRender="panelWizard" />
              
               </a4j:outputPanel>
               </t:column>
               </t:panelGrid>
               <a4j:outputPanel layout="block" styleClass="groupFooter">
               <h:outputText value="Home" />
               </a4j:outputPanel>
               </a4j:outputPanel>
               </a4j:outputPanel>
               </a4j:outputPanel>
               </t:column>
               </t:panelGrid>
               </rich:tab>
               </rich:tabPanel>
               </h:form></td>
               <td style="background-color: #DDDDDD"></td>
               </tr>
               </table>
              </f:view>
              </body>
              </html>
              

              a JSP file is included in PanelWizard
              here is code for WIZARD>JSP
              
              <a4j:outputPanel layout="block" id="panelWizard2" rendered="true"
               style="height: 100%">
               <a4j:region>
              
               <a4j:outputPanel layout="block"
               style="height: 60px; background-color: white;" rendered="true">
               <t:panelGrid columns="1">
               <t:column>
               <t:outputText value="{mainBind.customWizard.pageTitle}"
               styleClass="wizardTitle" />
               </t:column>
               <t:column>
               <t:outputText value="{mainBind.customWizard.description}"
               styleClass="wizardDescription" />
               </t:column>
               </t:panelGrid>
               </a4j:outputPanel>
              
               <a4j:outputPanel layout="block" style="height: 100%">
               <a4j:include viewId="ConfigureHostWizard.jsp" id="jsppage" />
               </a4j:outputPanel>
               </a4j:region>
              </a4j:outputPanel>
              

              in WIZARD.jsp i have include one more file
              ConfigureHostWizard.jsp
              code for that is
              
              <a4j:region id="hostRegion">
               <rich:modalPanel id="lanBrowser" binding="#{modelPanel.lanDialog}"
               style="overflow : auto;">
               <jsp:include page="LanBrowser.jsp" />
               </rich:modalPanel>
              
              
              
               <t:panelGroup id="panelConfigureHostWizard">
              
              
               <t:panelGrid columns="1" styleClass="WizardSPMiddle" align="center"
               id="hostDetailsPanel">
               <t:panelGrid columns="1" styleClass="WizardSPMiddleInner"
               rendered="true">
               <t:column>
               <t:outputLabel value="User name:"></t:outputLabel>
              
               <h:inputText value="#{modelPanel.lanBrowser.configure}" size="30">
               </h:inputText>
              
              
               </t:column>
               <h:outputLabel value="Select what to configure"></h:outputLabel>
               <h:selectOneMenu>
               <f:selectItem itemLabel="{userType}" />
               </h:selectOneMenu>
               <f:verbatim>
               <fieldset><legend>Host Details</legend> <t:panelGrid
               columns="1">
               <h:outputLabel value="Host Name:"></h:outputLabel>
               <t:column>
               <h:inputText value="{hostUserInfo.name}" size="70"></h:inputText>
               <rich:spacer width="8" />
               <a4j:commandButton value="Select" styleClass="CommandButton"
               action="#{modelPanel.lanBrowser.configHost}"
               oncomplete="Richfaces.showModalPanel('lanBrowser');"
               reRender="lanBrowser"></a4j:commandButton>
               </t:column>
               <h:outputLabel value="Folder Name"></h:outputLabel>
               <h:inputText
               value="{mainBind.customWizard.lanBrowser.hostUserInfo.folderName}"
               size="70"></h:inputText>
               <h:outputLabel value="Host URI"></h:outputLabel>
               <h:inputText
               value="{mainBind.customWizard.lanBrowser.hostUserInfo.uri}"
               size="70"></h:inputText>
               </t:panelGrid></fieldset>
               </f:verbatim>
               </t:panelGrid>
               </t:panelGrid>
              
              
              
               </t:panelGroup>
              </a4j:region>
              

              when i click on button it opens a new modal panel which contain a lanBrowser.jsp code is
              <a4j:region>
               <rich:modalPanel id="lanLoginDialog"
               binding="#{modelPanel.lanLoginDialog}">
              
               <jsp:include page="LanLogin.jsp" />
              
               </rich:modalPanel>
              
               <t:panelGroup id="networkTree">
              
               <t:panelGrid columns="3">
               <t:column>
               <t:outputLabel value="User name:"></t:outputLabel>
              
               <h:inputText value="#{modelPanel.lanBrowser.lanB}" size="30">
               </h:inputText>
               <t:outputLabel value="Username from"></t:outputLabel>
               <h:inputText value="#{modelPanel.lanBrowser.lanlogin}" size="30">
               </h:inputText>
               </t:column>
               <t:column style="valign:top">
              
               <a4j:commandLink value="{node.description}" styleClass="nodeFolder"
               action="#{modelPanel.lanBrowser.treeNodeClick}"
               oncomplete="Richfaces.showModalPanel('lanLoginDialog');"
               reRender="lanLoginDialog" />
               </t:column>
               <a4j:commandButton value="OKgo" type="button"
               action="#{modelPanel.lanBrowser.treeNodeClick}"
               onclick="Richfaces.showModalPanel('lanLoginDialog');"
               reRender="panelConfigureHostWizard"></a4j:commandButton>
              
               <a4j:commandButton value="OK" type="button"
               action="#{modelPanel.lanBrowser.treeNodeClick}"
               onclick="Richfaces.hideModalPanel('lanBrowser');"
               reRender="panelConfigureHostWizard"></a4j:commandButton>
              
               </t:panelGrid>
               </t:panelGroup>
              
              </a4j:region>
              

              in this LanBrowser.jsp , i click on a link it will open another model panel which contain LAnLogin.JSP code for that
              <a4j:region>
              <t:panelGroup>
              <t:panelGrid columns="1" columnClasses="navigation, navigation"
               align="center" styleClass="LoginPageDown" id="lanLoginBlock">
              
               <t:outputLabel value="User name:"></t:outputLabel>
              
               <h:inputText value="#{modelPanel.lanBrowser.lanlogin}" size="30">
               </h:inputText>
              
              
               <t:column>
               <a4j:commandButton value="OK" type="button"
               oncomplete="Richfaces.hideModalPanel('lanLoginDialog');"
               action="#{modelPanel.lanBrowser.reGenerateLan}"
               reRender="panelConfigureHostWizard"
               styleClass="CommandButton" />
               </t:column>
              
               <t:column>
               <a4j:commandButton value="OKBCK" type="button"
               action="#{modelPanel.lanBrowser.treeNodeClick}"
               onclick="Richfaces.hideModalPanel('lanLoginDialog');"
               reRender="panelConfigureHostWizard,networkTree"></a4j:commandButton>
              
               <rich:spacer width="10"></rich:spacer>
               <a4j:commandButton value="Cancel"
               onclick="Richfaces.hideModalPanel('lanLoginDialog');" action="#"
               styleClass="CommandButton"></a4j:commandButton>
               </t:column>
              </t:panelGrid>
              </t:panelGroup>
              
              </a4j:region>
              
              

              now LANLOGIN.jsp means the last code i paste contains one Text box and it is bind with a beans when i click on OK button i am unable to get value of text box,
              i want this value when last modal panle is closed, but all are opens