You need to sign in to do that
Don't have an account?
mac admin
Update method with in the same controller
Hi all,
I want to write the update method with in the same controller. For four vfpage i have written a single controller in the save method i have written a redirect method to second page with saved record ID. Now I want to update the second page values and redirect to third page.
Can anyone help me over here.
Thanks inadvance.
Regards,
mac.
I want to write the update method with in the same controller. For four vfpage i have written a single controller in the save method i have written a redirect method to second page with saved record ID. Now I want to update the second page values and redirect to third page.
Can anyone help me over here.
Thanks inadvance.
Regards,
mac.
For example, calling URL for Page1 would be CURRENT_URL+ '&Page=Page1'
When you set the PageReference in APEX class, read this parameter and set thew further redirect accordingly.
Here is the code sample for that.
and so on....
Let me know if this helps.
Thanks for the reply, all the code has to be in the save method right..?
And, if you are calling first VF page from a custom button or link, check out if you can add Page=Page1 as part of the query string there.
If it doesn't work out, your IF and ELSE IF conditions should check from Page2 onwards. And, the Page1 will be checked as part of the last ELSE condition (because you don't have a query string to check).
Hope this helps.
Hi LBK,
I have written a redirection method in the save method to redirect to second page after saving the first page. Below is my redirection method:
public PageReference page2() {
this.ugId = ApexPages.currentPage().getParameters().get('id');
Pagereference ref = new Pagereference('/apex/Page2?id=' +this.ugId);
ref.setRedirect(true);
return ref;
}
The page is redirecting to second page, here I want to update the page 2 data in the db of same record and redirect to 3rd page. Can you please help me over here.
Thanks in advance.
Regrads,
mac.
Are you not using a single Save method for all the pages?
If you are using different save method for different pages, within the same APEX class, you don't even need the querystring to identify the page.
Can you please post your APEX class and VF pages (may be Page 1 and Page 2 will suffice), so that I can help you better?
Below is my controller
Your Save method will look like this.
Look at the commented lines in the code and add the right elements from your VF page to save the data.
I have change my code with your code. After saving the first page it's not redirecting to second page it's redirecting to congrats page. Can you help me where I have done mistake.
How do you access your Page1?
Can you provide me the URL of the Page1?
You can copy it from the address bar, when you land in the page (you can remove the content till force.com/).
My first page is the home page for the Force.com Sites.
https://developer-XXXXX.XXXXXX.force.com/GraduateApplication/
is my first page URL. After filling the data in this (page1) when we click on Next button then it redirects to page2 but in the URL it will appears as below
https://developer-XXXXXXXX.XXXXX.force.com/GraduateApplication/page1
Or Page1 is your first page?
Your Next button in your Page1, should have the PageReference like this (if it has to go to Page2).
https://developer-XXXXXXXX.XXXXX.force.com/GraduateApplication/page2?Page=Page2&id=YOUR_UGFORM_ID_HERE
If you find it difficult to interpret this, post your Save method and names (just names) of all the Visualforce pages in Chronological order.