Skip to content

Instantly share code, notes, and snippets.

@kiran-machhewar
Created April 2, 2014 17:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kiran-machhewar/9939157 to your computer and use it in GitHub Desktop.
Save kiran-machhewar/9939157 to your computer and use it in GitHub Desktop.
<apex:page standardController="Opportunity">
<apex:includeScript value="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"/>
<apex:form >
<apex:pageMessages id="pageMessages"/>
<apex:pageBlock title="Custom Picklist Demo">
<apex:pageBlockSection >
<apex:repeat value="{!$ObjectType.Opportunity.Fieldsets.PicklistDemoFields}" var="field">
<apex:inputField value="{!opportunity[field]}" rendered="{!$ObjectTYpe.Opportunity.fields[field].Type!='reference'}"/>
<apex:pageBlockSectionItem rendered="{!$ObjectTYpe.Opportunity.fields[field].Type=='reference'}" >
<apex:outputLabel value="{!$ObjectType.Opportunity.fields[field].Label}"/>
<c:Picklist id="name" style="width:50%" required="{!OR(field.required, field.dbrequired)}"
labelField="Name" valueField="Id" objectName="{!$ObjectType.Opportunity.fields[field].ReferenceTo[0]}"
value="{!opportunity[field]}"
filterFields="{!IF(field='Contact__c','AccountId','')}"
filterValues="{!IF(field='Contact__c','.AccountId','')}"
styleClass="{!field}"></c:Picklist>
</apex:pageBlockSectionItem>
</apex:repeat>
</apex:pageBlockSection>
<center>
<apex:commandButton action="{!save}" reRender="pageMessages" value="Save Opportunity"/>
</center>
</apex:pageBlock>
</apex:form>
</apex:page>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment