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
dkndkn 

sites page

Hi

 

I have created a public sites page , where a person who is outside salesforce system , enters data and clicks save.So, I want to create an other visual force page with a simple thank you message .So, that when a person click this save button it takes him to the thank you page.I would really appreciate any suggestions , ideas  , solutions..help me !!!!

 

thank you

 

Ispita_NavatarIspita_Navatar

As the the user enters data and clicks of Save  and the record is created successfully, which you can find out from the SaveResult object- you can redirect the user to the thankyou page else you can add an error to the object being created which will display the error message in the area where you have used <apex:message>.

In case you want a classy implementation you can avoid the creation of a separate page , by using <div>.

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.

BulentBulent

Take a look at the Force Platform Developer Guide Chapter 14 shows a sample application.

dkndkn

Hi Bulent,

 

I appreciate your reply, it was helpful but

 

 

I am using an standard controller, how can link page now...

 

 

dkndkn

Hi Ispita,

 

I need to redirect them to the thank you page , that is my question ..of how to do that since, I am using standar controller.

 

I would appreciate your reply.

 

thank you

 

 

BulentBulent

you need to extend the standard controller to have your own save action. in this actin you can save the record via the standard controller and redirect to your own custom page. If you just use the standard controller save action will take user to the standard detail page after save

sales4cesales4ce

For to navigate the user to a new page when he clicks on the Save button requires you to use Controller extension that extends your standard controller.

 

for ex: I am using OpportunityLineItem standard controller and then extending it with extension.

VF Page:

<apex:page standardController="OpportunityLineItem" extensions="myControllerExtension" title="Product" tabStyle="Opportunity">
<apex:sectionHeader title="Opportunity / Product">
<apex:form >
<apex:commandButton action="{!save}" value="save "></apex:commandButton>
<apex:inputField id="cwSection" value="{!OpportunityLineItem.TotalPrice}" />
<apex:inputField id="cwService" value="{!OpportunityLineItem.ServiceDate}" />
...
</apex:form>
</apex:sectionHeader>
</apex:page>

Controller Extension:

public class myControllerExtension {

private final ApexPages.StandardController controller;

// The extension constructor initializes the private member
// variable acct by using the getRecord method from the standard
// controller.
public myControllerExtension(ApexPages.StandardController stdController) {
this.controller = stdController;
}


public PageReference Save()
{
OpportunityLineItem oli = (OpportunityLineItem)controller.getRecord();
System.debug( 'new value entered is ' + oli.totalprice );
Update oli;
Pagereference thanksPage= Page.thanksPage;
thanksPage.setRedirect(True);
return thanksPage;
}

}

 

And finally you also need to add the VF pages that you are exposing through Sites to the "Guest" Profile of the sites.

Also make sure that Guest profile has permissions set on the objects that you are exposing through the sites.

 

Hope this helps!