File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes Ajax to Make panel Visible or Hidden Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Ajax to Make panel Visible or Hidden" Watch "Ajax to Make panel Visible or Hidden" New topic

Ajax to Make panel Visible or Hidden

chandra chatterjee

Joined: May 13, 2009
Posts: 18
Is it possible to call a java script and make a panel grid visible or hidden with out refreshing the page?

I tried using this way it reflects the entire page

<t:commandLink onclick="showpanel()">
<hutputText styleClass="out" value="Sign In"/>
<a4j:support event="onclick" immediate="yes" ajaxSingle="true"> </a4j:support>

<h:panelGrid id ="signInGrid" styleClass="signin" columns="4">
<hutputText value="Username"/>
<h:inputText id="un" size="10" required="true"></h:inputText>
<hutputText value = "Password" />
<h:inputSecret id="pwd" size="10" required="true"/>
<h:message for="un"></h:message>
<h:message for="pwd"></h:message>
<hutputText value=""></hutputText>
<h:commandButton value="Login"></h:commandButton>

where showpanel() containts document.getElementById("form:signInGrid").style.display='';

Please advice thanks in advance.

The core idea of the functionality is to show the username and passowr fields on click of sign in.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17410

If you're already using a4j, check out the RichFaces Toggle Panel. It provides that kind of functionality without requiring any user-defined JavaScript code at all.

Some something like this, they also provide a ModalDialog tag that might be useful.

An IDE is no substitute for an Intelligent Developer.
I agree. Here's the link:
subject: Ajax to Make panel Visible or Hidden
It's not a secret anymore!