5 Replies Latest reply on Sep 24, 2010 10:13 AM by Andrey Markhel

    jsf client id and page refresh problem with richfaces modal panel

    Swapnil Rawat Newbie

      Hello Everyone,

                We are developing a portal project where my team is using JBOSS Portal EPP CP 4.3, JSF 1.2, Seam 2.0 and Richfaces 3.1.

      There are few things i we are looking for :

       

      1. How to get the components client id. Its beacause the jsf prepends its own id, along with that when the application is deployed on jboss portal, then the components ids again get prepended with the portal stuff. I have no clue how can i access a component, if i want to perform some javascript functionality onclient side.

       

      2. We have used Richfaces Modal Panel to implement search fucntionality, this modal panel is rendered when the page loads and the data which is shown on this search modal panel is populated from database, for this purpose we have used *.page.xml where we are calling an action to a backing bean. We have a form within our modal panel, the problem here is when i submit the form or even when i close the modal panel, the page gets refresh and that action defined within page.xml file is getting called each time which we dont want. How can i restrict the page from getting refresh after closing or submitting the form in modal panel.

       

      3. How to show validation messages as a tool tip.

       

      Thanks and Regards

      Swapnil

        • 1. Re: jsf client id and page refresh problem with richfaces modal panel
          Swapnil Rawat Newbie

          Please guys somebody please help me out on this

          • 2. Re: jsf client id and page refresh problem with richfaces modal panel
            Mehmet Salgar Novice

            May be that can help

             

            Namespacing
            In situations where you need to use the id of an element in your JSF/xhtml markup, you would normally see something like 'form1:myBtn' in the rendered markup. But now with the bridge namespacing you will see something similar to:
            jbpns_2fdefault_2fNews_2fStories_2fStoryTemplateWindow12snpbj:_viewRoot:form1:myBtn
            To overcome this, you can use the following expression in your Facelets page to prepend the namespace to your javascript code:
            document.getElementById('#{facesContext.externalContext.response.namespace}the_rest_of_JSF_ID
            since this uses the portletResponse, once you try to view this page on the servlet application side, you will get an exception. To avoid this, you need to check for the type of response in your backing bean and assign a new "safe" namespace variable for the UI.

            Namespacing

            In situations where you need to use the id of an element in your JSF/xhtml markup, you would normally see something like 'form1:myBtn' in the rendered markup. But now with the bridge namespacing you will see something similar to:

             

            jbpns_2fdefault_2fNews_2fStories_2fStoryTemplateWindow12snpbj:_viewRoot:form1:myBtn

             

            To overcome this, you can use the following expression in your Facelets page to prepend the namespace to your javascript code:

             

            document.getElementById('#{facesContext.externalContext.response.namespace}the_rest_of_JSF_ID

             

            since this uses the portletResponse, once you try to view this page on the servlet application side, you will get an exception. To avoid this, you need to check for the type of response in your backing bean and assign a new "safe" namespace variable for the UI.

            • 3. Re: jsf client id and page refresh problem with richfaces modal panel
              Markos Fragkakis Newbie

              1. You can add the attribute prependId="false" in the form of your page. The ids you have set for your components will be used as is.

              1 of 1 people found this helpful
              • 4. Re: jsf client id and page refresh problem with richfaces modal panel
                Akaine Harga Novice

                Also you can call elements by their "clean" id using RF component finder: #{rich:component('myId')} which returns the JS element object.

                 

                Example:

                <rich:modalPanel id="myModalPanel">

                 

                some event attached to some other element showing the modal panel:

                onclick="#{rich:component('myModalPanel')}.show();"

                1 of 1 people found this helpful
                • 5. Re: jsf client id and page refresh problem with richfaces modal panel
                  Andrey Markhel Newbie

                  1. Use onclick="#{rich:component('myModalPanel')} finder

                  2. I guess your code for closing popup is wrong, can you post your code? Anyway you can use in pages.xml next construction:

                  <action on-postback="false" execute="#{indexManager.init}"/>
                  3. Can you post the code and describe concrete problem?