File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes How to display richPopupPanel wondow from javascript Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "How to display richPopupPanel wondow from javascript" Watch "How to display richPopupPanel wondow from javascript" New topic
Author

How to display richPopupPanel wondow from javascript

Jaik Singh
Greenhorn

Joined: Sep 22, 2010
Posts: 20
Hello All,
I have one code like below of Rich PopupPanel.

Code:-
===============

<rich:popupPanel id="simplePopup1" autosized="true" width="300"
height="60" moveable="true" resizeable="false" zindex="100"
onmaskclick="#{rich:component('simplePopup1')}.hide()">
<f:facet name="header">
<h: outputText value="Popup" />
</f:facet>
<f:facet name="controls">
<h: outputLink value="#"
onclick="#{rich:component('simplePopup1')}.hide(); return false;">
X
</h: outputLink>
</f:facet>
<a4j:region>
<a4j: outputPanel ajaxRendered="true">
<h:form ajaxSubmit="true">
<h:panelGrid columns="1">
<a4j:commandLink action="#{popupBean.eventHandler.onClose}"
value="close" immediate="true" />
</h:panelGrid>
</h:form>
</a4j: outputPanel>
</a4j:region>
</rich:popupPanel>

I am able to make this popup visible using the a4j:commandbutton. But instead of that, I want to show this popup window using the javascript code.

Anyone have any idea, how to achieve that.

I have been trying with below code but its not working.

<a4j: outputPanel>
<script type="text/javascript">
javascript:document.getElementById('simplePopup1').style.display = 'none'; //or javascript:rich:component('simplePopup1')}.show();
</script>
</a4j: outputPanel>

Thanks
Jaikrat Singh
Kumaravadivel Subramani
Ranch Hand

Joined: Jul 05, 2008
Posts: 166

By defining display style "none" an element will be displayed in a HTML form. Have refer the following link for more clarification.

webpage


No pain, No gain.
OCJP 1.6
Kumaravadivel Subramani
Ranch Hand

Joined: Jul 05, 2008
Posts: 166

"will not be displayed". sorry type mistake ...
Jaik Singh
Greenhorn

Joined: Sep 22, 2010
Posts: 20
Sorry, my mistake. But even if I use

document.getElementById('popupContainer:popupView1:simplePopup1').style.display='block';


it does not work.

Thanks
Jaikrat
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16019
    
  20

I wouldn't attempt to use dynamic CSS to show/hide a RichFaces popup panel. They wouldn't be aware of the internal functionality of the panel.

Actually, I can't find "rich:popupPanel" in the live documentation. I don't know if that's because you're using the newer RichFaces that isn't in production or if you simply created a RichFaces tag that doesn't exist.

I've been using the rich:modalPanel and it works just fine with the show and hide javascript functions.


Customer surveys are for companies who didn't pay proper attention to begin with.
Jaik Singh
Greenhorn

Joined: Sep 22, 2010
Posts: 20
Agree Tim. Even earlier I was using modalPanel and doing this hide/show with javascript:Richfaces.showModalPanel(...) method. But I think this modalPanel component is no more available since RichFaces4.x.

Please correct my understanding if I am wrong.

Thanks
Jaikrat Singh
Jaik Singh
Greenhorn

Joined: Sep 22, 2010
Posts: 20
Any thought, Tim???

Thanks
Jaik
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16019
    
  20

Sorry. I haven't had the luxury of attempting RichFaces 4 yet. But it's still fairly unstable, if what I hear from a distance is any indication.

I'll be glad when it goes live, though, since there are significant advantages in its design.

As far as losing support for the modalDialog, I hope not. That's supposed to be one of the big advantages of using Java. Unlike a certain other drafty platform, Java deprecates instead of simply yanking old stuff out from underneath you.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to display richPopupPanel wondow from javascript