Skip to content

Instantly share code, notes, and snippets.

@joshbirk
Created November 9, 2011 18:37
Show Gist options
  • Save joshbirk/1352422 to your computer and use it in GitHub Desktop.
Save joshbirk/1352422 to your computer and use it in GitHub Desktop.
Controlling outputpanel with JavaScript
<apex:page showHeader="false" StandardController="Account">
<script>
function changevalue(input) {
value = input.options[input.selectedIndex].value;
if(value == 'Customer - Channel') {
document.getElementById('{!$Component.myform.mypanel}').style.display = 'none';
} else {
document.getElementById('{!$Component.myform.mypanel}').style.display = 'block';
}
}
</script>
<apex:form id="myform">
<apex:inputField id="type" value="{!Account.Type}" onchange="changevalue(document.getElementById('{!$Component.type}'));" />
<apex:outputPanel id="mypanel" layout="block">
Hello World
</apex:outputPanel>
</apex:form>
</apex:page>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment