Skip to content

Instantly share code, notes, and snippets.

@amonshiz
Last active August 29, 2015 14:11
Show Gist options
  • Save amonshiz/2e761828d106777e9fdc to your computer and use it in GitHub Desktop.
Save amonshiz/2e761828d106777e9fdc to your computer and use it in GitHub Desktop.
apex:component controller="ActionButtonsComponentController">
<apex:attribute name="prev" assignTo="{!prevPage}" description="The previous page" type="String" required="true" />
<apex:attribute name="next" assignTo="{!nextPage}" description="The next page" type="String" required="true" />
<apex:form>
<apex:commandButton action="{!goToPage1}" value="Page 1" id="button1" />
<apex:commandButton action="{!goToPage2}" value="Page 2" id="button2" />
</apex:form>
</apex:component>
public with sharing class ActionButtonsComponentController {
public ActionButtonsComponentController() {}
public String prevPage { get; set; }
public String nextPage { get; set; }
public PageReference goToPage1 () {
return new PageReference('/apex/' + prevPage);
}
public PageReference goToPage2 () {
return new PageReference('/apex/' + nextPage);
}
}
<apex:page showHeader="true" sidebar="true">
<apex:sectionHeader title="Page 1" />
<c:ActionButtonsComponent prev="Page1" next="Page2" />
</apex:page>
<apex:page showHeader="true" sidebar="true">
<apex:sectionHeader title="Page 2" />
<c:ActionButtonsComponent prev="Page1" next="Page2" />
</apex:page>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment