Skip to content

Instantly share code, notes, and snippets.

@ralphcallaway
Created November 26, 2012 16:02
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 ralphcallaway/4148963 to your computer and use it in GitHub Desktop.
Save ralphcallaway/4148963 to your computer and use it in GitHub Desktop.
Alternative Implementation of Client Preferces
<apex:form >
<apex:pageBlock id="cp_module" rendered="{!detailKey = 'cp'}" title="Client Preferences" mode="edit">
<apex:pageblockButtons location="top">
<apex:commandButton value="Edit" rendered="{!NOT(clientPreferencesModification)}"
rerender="cp_module" status="LoadingStatusSpinner">
<apex:param assignTo="{!clientPreferencesModification}" value="true"/>
</apex:commandButton>
<apex:commandButton value="Save" rendered="{!clientPreferencesModification}"
action="{!saveClientPreferences}" status="LoadingStatusSpinner"
rerender="cp_module, im_counts"/>
<apex:commandButton value="Cancel" rendered="{!clientPreferencesModification}"
rerender="cp_module" status="LoadingStatusSpinner">
<apex:param assignTo="{!clientPreferencesModification}" value="false"/>
</apex:commandButton>
</apex:pageblockButtons>
<!-- client preferences DISPLAY MODE -->
<apex:pageBlockSection columns="1" id="cp_display_block" rendered="{!NOT(clientPreferencesModification)}">
<apex:outputField value="{!account.Target_Equity_Allocation__c}"/>
<apex:outputField value="{!account.Target_Fixed_Allocation__c}"/>
<!-- Repeat for additional fields -->
<!-- only need to do page block section item if we want to use a different label than normal -->
<apex:pageBlockSectionItem >
<apex:outputLabel for="cp_first_goal" value="Different Label than is defined for field"/>
<apex:outputField id="cp_first_goal" value="{!Account.First_goal__c}"/>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
<!-- client preferences EDIT MODE -->
<apex:pageBlockSection columns="1" id="cp_edit_block" rendered="{!clientPreferencesModification}">
<!-- Reference standard controller account directly to simplify controller -->
<apex:inputField value="{!account.Target_Equity_Allocation__c}"/>
<!-- Repeat for additional fields -->
<!-- override label if needed in specific instances (although preference would be to update the actual fields label) -->
<apex:pageBlockSectionItem >
<apex:outputLabel for="cp_first_goal" value="Different Label than is defined for field"/>
<apex:inputField id="cp_first_goal" value="{!Account.First_goal__c}"/>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
<apex:form >
<apex:pageBlock id="cp_module" rendered="{!detailKey = 'cp'}" title="Client Preferences" mode="edit">
<apex:pageblockButtons location="top">
<apex:commandButton value="Edit" rendered="{!NOT(clientPreferencesModification)}"
rerender="cp_module" status="LoadingStatusSpinner">
<apex:param assignTo="{!clientPreferencesModification}" value="true"/>
</apex:commandButton>
<apex:commandButton value="Save" rendered="{!clientPreferencesModification}"
action="{!saveClientPreferences}" status="LoadingStatusSpinner"
rerender="cp_module, im_counts"/>
<apex:commandButton value="Cancel" rendered="{!clientPreferencesModification}"
rerender="cp_module" status="LoadingStatusSpinner">
<apex:param assignTo="{!clientPreferencesModification}" value="false"/>
</apex:commandButton>
</apex:pageblockButtons>
<!-- client preferences DISPLAY MODE -->
<apex:pageBlockSection columns="1" id="cp_display_block" rendered="{!NOT(clientPreferencesModification)}">
<apex:outputField value="{!account.Target_Equity_Allocation__c}"/>
<apex:outputField value="{!account.Target_Fixed_Allocation__c}"/>
<!-- Repeat for additional fields -->
<!-- only need to do page block section item if we want to use a different label than normal -->
<apex:pageBlockSectionItem >
<apex:outputLabel for="cp_first_goal" value="Different Label than is defined for field"/>
<apex:outputField id="cp_first_goal" value="{!Account.First_goal__c}"/>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
<!-- client preferences EDIT MODE -->
<apex:pageBlockSection columns="1" id="cp_edit_block" rendered="{!clientPreferencesModification}">
<!-- Reference standard controller account directly to simplify controller -->
<apex:inputField value="{!account.Target_Equity_Allocation__c}"/>
<!-- Repeat for additional fields -->
<!-- override label if needed in specific instances (although preference would be to update the actual fields label) -->
<apex:pageBlockSectionItem >
<apex:outputLabel for="cp_first_goal" value="Different Label than is defined for field"/>
<apex:inputField id="cp_first_goal" value="{!Account.First_goal__c}"/>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment