-
-
Save noeticpenguin/3239784 to your computer and use it in GitHub Desktop.
Apex Controller Class
This file contains hidden or 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
/** | |
* CustomSettingController | |
* @description controller class for updating custom settings... | |
* @date 8/2/2012 | |
*/ | |
public without sharing class CustomSettingController{ | |
public CustomSetting__c cs {get;set;} | |
public CustomSettingController(){ | |
cs = CustomSetting__c.getInstance(); | |
} | |
public PageReference update(){ | |
try{ | |
update cs; | |
ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.CONFIRM,Label.CS_Update_Success)); | |
}catch(DMLException e){ | |
ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,Label.CS_Update_Error)); | |
System.debug(e); | |
} | |
return null; | |
} | |
} |
This file contains hidden or 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 controller="CustomSettingController"> | |
<apex:pageMessages id="msgs" /> | |
<apex:form id="theform"> | |
<apex:inputField value="{!cs.Field1__c}" /> | |
<apex:inputField value="{!cs.Field2__c}" /> | |
<apex:commandButton value="{!$Label.CSTab_Save}" action="{!update}" rerender="msgs,theform" /> | |
</apex:form> | |
</apex:page> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment