5 Replies Latest reply on Sep 26, 2007 11:17 AM by msly

    Problem Getting Data into a ModalPanel

      I am just starting with richfaces and have the following problem:

      Here is the control in my page:

      <t:inputText id="setpressure" readonly="false" styleClass="permitdata" value="#{boilerPermitMB.safetyValveSetPressure}" onblur="javascript:validateSetPressure()" />


      Here is the javascript that is called in the onblur method:
      function validateCapacities()
      {
      var capacity = parseInt($('form1:boilercapacity').value);
      var valvecapacity = parseInt($('form1:valvecapacity').value);
      if(capacity != null && valvecapacity != null)
      {
      if(valvecapacity > capacity){
      $('form1:message').value = "The valve capacity is larger than the capacity of the item! If this is correct please make a special note in the comment section.";
      showPanel();
      }
      }
      }
      
      function showPanel(){
      Richfaces.showModalPanel('mp',{width:450, top:200});
      }
      


      Here is code for the richfaces modal panel:
      <rich:modalPanel id="mp" minHeight="200" minWidth="450"
       height="200" width="500" zindex="2000">
       <a4j:support event="onshow" reRender="mp">
       </a4j:support>
       <f:facet name="header">
       <h:outputText id="messageText" value="Alert Message" />
       </f:facet>
       <f:facet name="controls">
       <h:graphicImage value="/images/modal/close.png" style="cursor:pointer" onclick="Richfaces.hideModalPanel('mp')" />
       </f:facet>
       <t:outputText forceId="true" id="messageDisplay">
       <f:verbatim><script>document.write($('form1:message').value)</script></f:verbatim>
       </t:outputText>
      
      </rich:modalPanel>
      


      I cannot get the data that was set in the function to display in the page. I look at the page with a dom inspector and the value is set I just cant get the panel to rerender.

      Any help or Ideas would be appreciated. Does anyone have a complete example of passing variables in the show method? I tried the one in the docs and it said that the item was not defined?

        • 1. Re: Problem Getting Data into a ModalPanel

          If I call this method with parameters:

          Richfaces.showModalPanel('mp',{width:450, top:200},{myParm:'Hello'});
          And try to get it to show in an alert like this:

          onshow="alert(event.parameters.myParm)";

          It says that it is undefined in the alert box.

          Where would I define the parameter.

          I would like to pass in the message text for the panel and display it with an output text statement.

          • 2. Re: Problem Getting Data into a ModalPanel
            ilya_shaikovsky

            What about Rich faces version?

            • 3. Re: Problem Getting Data into a ModalPanel

              richfaces-impl-3.1.0-rc3.jar
              richfaces-api-3.1.0-rc3.jar
              richfaces-ui-3.1.0-rc3.jar

              I am also using Myfaces in this project.
              myfaces-impl-1.1.5.jar ...

              I am successfully using a modal panel as a dialog with controls that reference the managed bean behind the page.

              What I would like to do is pass a message into a panel and use it as an alert box. I want to include a file in all of my pages and show it with a custom message when needed.

              • 4. Re: Problem Getting Data into a ModalPanel
                ilya_shaikovsky

                did you explore the example in our guide where custom parameters passing described?

                • 5. Re: Problem Getting Data into a ModalPanel

                  I did and it says that the parameter is undefined. I think I am missing something. It could be something as simple as a parameter definition in javascript, but I am not sure how do define a parameter for it. If I could see a complete example I could probably figure this out. I will go through the document again and see if there is anything I missed.

                  I did have basic support when I licensed Exadel before Redhat took over. I guess that is gone now?