0

I have a4j command button in one xhtml page and popup panel in other. I want to open the the popup on commandbutton click in first page. the command button

auth.xhtml

<a4j:commandButton id="Add" value="Add New" type="submit"
   action="#{controller.add}"
   render=":addPopupForm:addPopupOp">
     <a4j:param value="true" assignTo="#{controller.ind}" ></a4j:param>
</a4j:commandButton>

addPopup.xhtml

<h:form id="addPopupForm">
    <a4j:outputPanel id="addPopupOp" ajaxRendered="true">
       <rich:popupPanel id="addPopup" domElementAttachment="parent" show="true"
          rendered="true" height="600" width="1000" >
            Row is added
       </rich:popupPanel>
   </rich:outputPanel>
</h:form>
alko
  • 46,136
  • 12
  • 94
  • 102

2 Answers2

0

I'm not a richfaces user but in general JSF , you can't re-render elements which are not rendered in the first place.

So in your case you should point to addPopupForm , like this :

 <a4j:commandButton id="Add" value="Add New" type="submit"
   action="#{controller.add}"
   render=":addPopupForm" >

Or wrap the a4j:outputPanel with some wrapper that will be always rendered

Also, take a look at this: Can you update an h:outputLabel from a p:ajax listener?

Community
  • 1
  • 1
Daniel
  • 36,833
  • 10
  • 119
  • 200
  • Can the component in one file access component in other file? – user2963784 Nov 08 '13 at 11:23
  • yes it can access component from other file, as long as one of included in the other using the `ui:include` – Daniel Nov 08 '13 at 12:39
  • Ok i will try ui:include then as my popup is in other file – user2963784 Nov 08 '13 at 13:46
  • well, since i;m not a richfaces expert, I can't help more, you can look for some tutorials , or how it can be done on primefaces maybe.. – Daniel Nov 11 '13 at 07:02
  • Hi when I tried showcase popup panel example from this url [linl](http://showcase.richfaces.org/richfaces/component-sample.jsf?demo=popup&skin=blueSky) even that isnt working. what can be the issue? – user2963784 Nov 12 '13 at 05:45
  • It works on the url but when i copy the code and run it in eclipse it doesnt on my localhost – user2963784 Nov 12 '13 at 14:06
  • look than for some richfaces basic tutorial, like hello world, again, I'm not a richfaces user, so I can't help you too much. – Daniel Nov 12 '13 at 18:37
0

Just rendering the panel does not mean showing it. You have to attach the popup "show" attribute to a property:

show="#{bean.showPopup}"

Set the showPopup boolean in the action method (action="#{controller.add}") and then do render="addPopupForm"

Amit Tikoo
  • 167
  • 6