You need to sign in to do that
Don't have an account?
AnnaT
After clicking [save] button
I created save button.
If I click this button, the page jumps to Dashbords page.
How can I set page direction?
<apex:form > <apex:commandButton action="{!save}" value="Save" id="theButton" /><br></br> <body>
Does your VFP has any standard controoler?
Are you using standard save or overrided it i your class?
Please answer aove questions?
Dear Shashikant Sharma,
>Does your VFP has any standard controoler?
No, this save button only.
>Are you using standard save or overrided it i your class?
I'm using standard save.
Thank you for your cooperation.
Anna
Sorry, maybe I misunderstood the meaning of standard controller.
I'm using standard controller which references my custom object.
I would suggest you to override the save in a extenstion class then you can redirect your page as per you requiremnt.
pibic PageReference save() {
upsert yuorObjectsinstace;
PageReference p = new PageReference(URL where you want to redirect);
return p;
}
Hi,
You cannot set your own redirection in standard save method. you have to create your save method in a apex class and name it as the extention of your VF page.
Controller(Extention)
If a reply to a post answers your question or resolves your problem, please mark it as the solution to the post so that others may benefit.
Chamil's Blog
to which page that you want to redirect or want to stay there on the same page or what?
Another approach you could take is to set a URL parameter called retURL. This parameter sets the page that is returned after a save operation. If you go to an edit page from a list view you will see an example of a URL with the retURL parameter. Then all you would have to is create custom buttons/links that call your VF page as a URL with the appropiate parameter. An example URL with the retURL parameter may be as follows:
http://na3.salesforce.com/myRecordID/e?retURL=%2fmyDashboardTabRelativeURL
Just wanted to give you another option if it will work in your case.
Thank you for your replies.
I created the following code but error never disappears when I try to deploy it to server...
I also don't know what to write test code exactly.
My test code is this.
Finally the error message is this.
Method Name Not Available
Line -1, column -1: Dependent class is invalid and needs recompilation:
I want to go to same page as save button located.
= I don't want to jump another page after clicking save button.
Thanks,
Anna
I changed code as following and I could save it to server.
But at Visualforce page, the followinig error appears when I use this code.
Error: Unknown constructor 'SaveController.SaveController(ApexPages.StandardSetController controller)'
How can I solve this?
You need a constructor for the extension class. In your original code, this was your constructor:
If you re-insert it into your code, that error should go away.
Thank you for your reply.
I inserted the code, but another error appears.
line -1, column -1:Dependent class is invalid and needs recompilation:
Add this to your class
Save the class, then after saving class now save your page