Created
November 9, 2011 18:38
-
-
Save joshbirk/1352434 to your computer and use it in GitHub Desktop.
Controlling outputpanel with Apex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public with sharing class MyExtension { | |
public Boolean showPanel {get; set;} | |
public String inputValue {get; set;} | |
public MyExtension(ApexPages.StandardController controller) { | |
inputValue = ''; | |
showPanel = true; | |
} | |
public PageReference controlPanel() { | |
showPanel = true; | |
if(inputValue == 'Customer - Channel') { | |
showPanel = false; | |
} | |
return null; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<apex:page showHeader="false" StandardController="Account" extensions="MyExtensions"> | |
<apex:form id="myform"> | |
<apex:actionFunction action="{!controlPanel}" name="controlPanel" rerender="mypanel" > | |
<apex:param name="inputValue" assignTo="{!inputValue}" value="" /> | |
</apex:actionFunction> | |
<apex:inputField id="type" value="{!Account.Type}" onchange="controlPanel(document.getElementById('{!$Component.type}').options[document.getElementById('{!$Component.type}').selectedIndex].value);" /> | |
<apex:outputPanel id="mypanel" layout="block" > | |
<apex:outputPanel rendered="{!showPanel}" ><apex:outputText value="{!inputValue}" />? {!showPanel}</apex:outputPanel> | |
</apex:outputPanel> | |
</apex:form> | |
</apex:page> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
try renaming from extension.class to extension.java and outputpanel.page to outputpanel.xml/html to get syntax coloring.