It's not a secret anymore!*
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Ajax to Make panel Visible or Hidden" Watch "Ajax to Make panel Visible or Hidden" New topic
Author

Ajax to Make panel Visible or Hidden

chandra chatterjee
Greenhorn

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

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

<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>
</h:panelGrid>
</a4j:region>

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: 15959
    
  19

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.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Ajax to Make panel Visible or Hidden
 
Similar Threads
Validation Problem ... again!
Validation skip
Take input from <h:inputText> in rich <modalPanel>
how to skip validation phase only
Problem with h:message and richfaces