Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Ajax to Make panel Visible or Hidden

 
chandra chatterjee
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 18272
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic