You need to sign in to do that
Don't have an account?
Lexington Holloway
save button for visual force page standard controller
can anyone please help me get the save button to work? Both cancel and Save and new button work but not the save button.
Here is my visual force page
and this is my class for saveandnew. Do i have to write a new class for save or how do i get it to work?
Here is my visual force page
<apex:page standardController="GCHFH_Rental_Partnership_Program__c" extensions="saveAndnew"> <apex:form > <apex:sectionHeader title="GCHFH Rental/Parnetship Programs Edit" subtitle="New GCHFH Rental/Parnetship Program" /> <apex:pageBlock title="GCHFH Rental/Parnetship Programs Edit"> <apex:pageBlockSection title="General Information"> <apex:inputField value="{!GCHFH_Rental_Partnership_Program__c.Date__c}"/> <apex:inputField value="{!GCHFH_Rental_Partnership_Program__c.Tenant_Vendor__c}"/> <apex:inputField value="{!GCHFH_Rental_Partnership_Program__c.Agreement_End_Date__c}"/> </apex:pageBlockSection> <apex:pageBlockSection > <apex:pageBlockSectionItem > <apex:outputLabel value="Category"/> <apex:actionRegion > <apex:inputField value="{!GCHFH_Rental_Partnership_Program__c.Category__c}"> <apex:actionSupport event="onchange" reRender="ajaxrequest,ajaxrequest1" /> </apex:inputField> </apex:actionRegion> </apex:pageBlockSectionItem> </apex:pageBlockSection> <apex:outputPanel id="ajaxrequest"> <apex:pageBlockSection rendered="{!GCHFH_Rental_Partnership_Program__c.Category__c=='GCHFH Building Space' || GCHFH_Rental_Partnership_Program__c.Category__c=='Habitat Home'}" > <apex:pageBlockSection title="Rental program"> <apex:inputField value="{!GCHFH_Rental_Partnership_Program__c.Account__c}"/> <apex:inputField value="{!GCHFH_Rental_Partnership_Program__c.Rent__c}"/> <apex:inputField value="{!GCHFH_Rental_Partnership_Program__c.Rent_due_date__c}"/> <apex:inputField value="{!GCHFH_Rental_Partnership_Program__c.Rent_Paid__c}"/> <apex:inputField value="{!GCHFH_Rental_Partnership_Program__c.Street_GCH_Space__c}"/> <apex:inputField value="{!GCHFH_Rental_Partnership_Program__c.State__c}"/> <apex:inputField value="{!GCHFH_Rental_Partnership_Program__c.City__c}"/> <apex:inputField value="{!GCHFH_Rental_Partnership_Program__c.Zip__c}"/> </apex:pageBlockSection> </apex:pageBlockSection> </apex:outputPanel> <apex:outputPanel id="ajaxrequest1"> <apex:pageBlockSection rendered="{!GCHFH_Rental_Partnership_Program__c.Category__c=='E-paint program' || GCHFH_Rental_Partnership_Program__c.Category__c=='Urban Wood Program'}" > <apex:pageBlockSection title="Partnership program"> <apex:inputField value="{!GCHFH_Rental_Partnership_Program__c.Donated_Item__c}"/> <apex:inputField value="{!GCHFH_Rental_Partnership_Program__c.Expected_Value__c}"/> <apex:inputField value="{!GCHFH_Rental_Partnership_Program__c.share__c}"/> </apex:pageBlockSection> </apex:pageBlockSection> </apex:outputPanel> <apex:pageBlockButtons > <apex:commandButton action="{!save}" value="Save"/> <apex:commandButton action="{!Cancel}" value="Cancel"/> <apex:commandButton action="{!saveAndNew}" value="Save & New"/> </apex:pageBlockButtons> </apex:pageBlock> </apex:form> </apex:page>
and this is my class for saveandnew. Do i have to write a new class for save or how do i get it to work?
public class saveAndnew { public ApexPages.StandardController scMain{get;set;} public saveAndnew(ApexPages.StandardController controller) { scMain = controller; } public PageReference save() { return null; } public PageReference saveAndNew() { scMain.save(); PageReference GCHFHRental= new PageReference('/apex/GCHFHRental'); GCHFHRental.setRedirect(true); return GCHFHRental; } }
That means you should remove these 3 lines.
public PageReference save() {
return null;
}
As a common practice, if your question is answered, please choose 1 best answer.
But you can give every answer a thumb up if that answer is helpful to you.
Thanks
All Answers
That means you should remove these 3 lines.
public PageReference save() {
return null;
}
As a common practice, if your question is answered, please choose 1 best answer.
But you can give every answer a thumb up if that answer is helpful to you.
Thanks
Thanks. It worked perfectly. I am using it for my website Qzlyrics.com check this article on sundarkand lyrics in hindi & Hanuman Chalisa Lyrics