You need to sign in to do that
Don't have an account?
megmooPDX
save button - refresh into edit mode after save
I have a VF page displaying as a component in a custom console. It allows the user to perform what I call "quick edits" for a few key fields. When the console is opened, those fields are displayed with the component in edit mode. If the users changes or adds to these fields, then clicks save, it does save the records as I want it to. However, instead of refreshing to display the VF page, it refreshes to display the page layout of the (custom) object into which the records were saved.
For a visual example, the first screen shot is what I want the left side component to look like all the time (before a save and after a save).
This is what the page looks like after a save - it displays the object's detail page in view mode. I want it to display my custom VF page which is the edit mode shown above.
Is this possible? Thanks in advance for any contributions!
For a visual example, the first screen shot is what I want the left side component to look like all the time (before a save and after a save).
This is what the page looks like after a save - it displays the object's detail page in view mode. I want it to display my custom VF page which is the edit mode shown above.
Is this possible? Thanks in advance for any contributions!
<pre>
public class YourExtension
{
private ApexPages.StandardController controller;
public YourExtension(ApexPages.StandardController controller)
{
this.controller = controller;
}
public void save()
{
controller.save();
}
}
</pre>
Alternatively your save method could be:
<pre>
public PageReference save()
{
controller.save();
return null;
}
</pre>
All Answers
As you said, you need to override Save method. To do so, create your own controller extension as it is explained here:
http://www.salesforce.com/us/developer/docs/pages/Content/pages_controller_extension.htm
You can either override it by declaring a PageReference save() method, or just by redirecting Save button to another custom method that you define in your extension class.
Example:
public PageReference save(){
//to do here
return standardController.save();
}
<pre>
public class YourExtension
{
private ApexPages.StandardController controller;
public YourExtension(ApexPages.StandardController controller)
{
this.controller = controller;
}
public void save()
{
controller.save();
}
}
</pre>
Alternatively your save method could be:
<pre>
public PageReference save()
{
controller.save();
return null;
}
</pre>
d.phillippi1 - I implemented your code and it worked perfectly. Thanks!