function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Donald Rey CarreonDonald Rey Carreon 

Sites.com - Click save button and go to Next Page

Hi

I am new in Salesforce development. I am creating a simple reference check apps using  force.com sites.
I am done with the VF page. But how can I able to override the save button to do additional things like
go to the thank you page.

I am now catching up with the reading using apex and  some post recommends to create a SF class to do this.
Please give me idea how can I do this. Thanks in advance
James LoghryJames Loghry
If I'm reading this correctly, you just want to provide your own save method in Visualforce?  If you're using a standard controller, you can override the standard controller's save method by simply using what's known as an extension or extension controller, and including the save method.  More info on that here: http://ccoenraets.github.io/salesforce-developer-workshop/Creating-a-Controller-Extension.html

If you're using a custom controller instead of a standard controller, it's very similar.  You'll just create the same save method and call it in your Visualforce page using something like action="{!save}"
PhyoPinePhyoPine
I am assuming you are using some kind of extension in your VF page like this?
 
<apex:page standardController="Order" extensions="autoThankYou" sidebar="false" showHeader="false">
And your save button on VF will be something like this??
 
<apex:commandButton action="{!save}"  value=" Go To Thank You "  id="goThankYou"  />

Then on your Apex page (Controller), creae a .cls file called "autoThankYou" and you can do something like this: ( I am asumming you have another VF page called thankYou.
 
public with sharing class autoThankYou{
 
   
   public pagereference save(){
       
      Pagereference redirectedPage = New PageReference('/thankYou');  
  
      return redirectedPage;
   }

}
Hope this helps.