4 Replies Latest reply on May 2, 2011 8:32 PM by simomon

    launch modal panel on load

    simomon
      Hi,

      I have created a rich faces modal panel ( borrowing code from this site :) )

      I am now trying to launch the panel on page load, from what i understand there is no "body onload"  functionality

      so i am trying to execute the modal panel from a Jquery script

      something like

      <script>
                $(document).ready(function(){
                     alert(" test jquery onload functinoality  !!!");
                    "loadthis" "#{rich:component('confirmation')}.show();return false;";
        
                });
      </script>

      but i am not sure how to call/load the component within the script  ?

      any help , ideas would be greatly appreciated :)

      thanks
        • 1. Re: launch modal panel on load
          rogermorituesta.rogermori.yahoo.com
           <!-- Load modal panel after loading the page -->
           <script type="text/javascript">
              jQuery(document).ready(function(){
                 Richfaces.showModalPanel('MP_ADD_REQINFO');
              });
           </script>
          
          


          • 2. Re: launch modal panel on load
            simomon
            thank you for the response.

            i am trying to launch a template/fragment that i have already created called

            confirm_modal_dialogue

            view-id="/WEB-INF/templates/fragment/confirm_modal_dialogue.xhtml"

            is it possible to launch a template in a similar manner ?


            <!-- Load modal panel after loading the page -->
            <script type="text/javascript">
                jQuery(document).ready(function(){
                   Richfaces.launchFragment("confirm_modal_dialogue"); << ??
                });
            </script>

            thanks
            • 3. Re: launch modal panel on load
              simomon
              actually thankyou roger  the above was the answer :)


              ie name of modal template i made id = confirmation

              <script type="text/javascript">
                          jQuery(document).ready(function(){
                                 Richfaces.showModalPanel('confirmation');
                       });
              </script>

              • 4. Re: launch modal panel on load
                simomon
                actually

                the above script won't work unless there is a reference to the fragment on the page


                <script type="text/javascript">
                            jQuery(document).ready(function(){
                   
                            Richfaces.showModalPanel('confirmation');
                           
                         });

                <ui:include
                     src="/WEB-INF/templates/fragment/confirm_modal_dialogue.xhtml">
                </ui:include>


                cheers