Hide and Show in Visualforce page

Sample code:

Apex:

public class popup
{
  public boolean displayPopup {get; set;}

  public void closePopup()
  {
    displayPopup = false;
  }

  public void showPopup()
  {
    displayPopup = true;
  }
}

Visualforce page:

<apex:page controller = "popup">
   <apex:form>
    <apex:commandButton value = "Show" action = "{!showPopup}"/>
    <apex:outputPanel layout = "block" rendered = "{!displayPopup}">
      <apex:commandButton value = "hide" action = "{!closePopup}"/>
    </apex:outputPanel>
   </apex:form>
</apex:page>

Cheers!!!

No comments:

Post a Comment