-
1. Re: Generate Pop Up from Server Side using JSF/Richfaces
iabughosh Feb 22, 2012 2:17 AM (in response to jsf_pk)hello parthi,
try this psudo code:
<h:form>
<a4j:commandButton id="submit"
value="submit"
actionListener="#{yourBean.validateYourCriteria}"
oncomplete="if(#{yourBean.isValid}){#{rich:component('yourPopup')}.show();}"/>
<rich:popupPanel id="yourPopup" domElementAttachment="form">
<h:commandButton id="ok" value="ok" action="#{yourBean.navigateToAnotherPage}"/>
<h:commandButton id="cancel" onclick="#{rich:component('yourPopup')}.hide(); return false;"/>
</rich:popupPanel>
</h:form>
regards.
-
2. Re: Generate Pop Up from Server Side using JSF/Richfaces
jsf_pk Feb 22, 2012 2:33 AM (in response to iabughosh)Thanks Ibrahim,
This is working.
But is there any way to generate the pop up from server side?
the below sceneria
SearchResultActionBean.java
if(StringUtils.equals(search.getRequestStatus(), UpswcsConstants.AGGREGATION_FAILURE)){
message = " Aggregation: Failed" +
" The aggregation process for this request has failed. "+
" Please contact the help desk quoting the " +
" Social Security number and Reply Date. " +
" Would you likt to view Payroll Details. ";
When this condition satisfied, I have to set this message in the pop up added with OK and Cancel button? How can I acheive this?
-
3. Re: Generate Pop Up from Server Side using JSF/Richfaces
iabughosh Feb 22, 2012 3:32 AM (in response to jsf_pk)ok, there is no much changes to the previous code,
add to your bean String msg; with getters and setters then modify your action listener(actionListener="#{yourBean.validateYourCriteria}") method:
to set your msg like your post.
in your xhtml page add render attribute to your submit button:
<h:form>
<a4j:commandButton id="submit"
value="submit"
render="yourPopup"
actionListener="#{yourBean.validateYourCriteria}"
oncomplete="if(#{yourBean.isValid}){#{rich:component('yourPopup')}.show();}"/>
<rich:popupPanel id="yourPopup" domElementAttachment="form">
<div align="center">
<h:outputText value="#{yourBean.msg}"/><br/>
<h:commandButton id="ok" value="ok" action="#{yourBean.navigateToAnotherPage}"/>
<h:commandButton id="cancel" onclick="#{rich:component('yourPopup')}.hide(); return false;"/>
</div>
</rich:popupPanel>
</h:form>
-
4. Re: Generate Pop Up from Server Side using JSF/Richfaces
healeyb Feb 22, 2012 7:20 AM (in response to iabughosh)Have a look at the rich:popupPanel show= attribute - this is supposed to be for displaying a popupPanel from a server
side action, although I've not tried it myself. An associated comment in "Pratical Richfaces 2" says that if you're making
changes via ajax "don't forget to update the entire component in order for it to get re-initialized and shown/hidden based
on a new value". I take this to mean use the id of the popopPanel itself, not the content as you'd normally do.
Regards,
Brendan.
-
5. Re: Generate Pop Up from Server Side using JSF/Richfaces
jsf_pk Feb 23, 2012 9:40 AM (in response to healeyb)Hi,
Sorry for the late reply...I got bugged in another problem I cant see your reply...
Very thanks for the reply's.
Do you havea any code samples available with you for how to call the popup from java code?