You need to sign in to do that
Don't have an account?
VF page save and then reload current page
Hi All,
I hope this is a simple problem and I'm just missing something.
I am trying to build a controller extension that saves a VF form page details and then reloads the same page.
This should be straight forward but when I try and use the documented way to do this, the data is saved and the return page is the page I wanted, but along with it the URL of the page , a long string of test has been appended to the end, the apex seems to be wanting to map the details of the fields on the page when it reloads.
This in itself would not a problem, but some users are getting an authentication error when the page reloads, and i assume this has something to do with it.
Any help would be great.
Thanks all
How are you reloading the page? Are you simply returning the current page or are you constructing your own page reference?
The page in question is a a basic form that I would like to save , clear the drop downs and let the user complete again (over and over) as it will be used for logging activity.
at the moment , the data is saved and the page is reload , but a long string is added to the end of the URL, like this :
unsure why its happening. below is the section of the controller that should do the work:
Any ideas??
Wow - its trying to maintain the viewstate through a URL parameter. Nice.
Looks like you need to recreate the pagereference rather than using a reference to the existing one.
The following should do it:
Does your VF page use a standard controller? If so, you'll need to add the record id as a parameter to the page reference.
Thanks Bob,
Below is my full controller , with the chages you suggested, could you let me know if this is what you had in mind ?
I am using a standard controller and this is just an extension, do I still need to get the record ID and if so how ?
Thank again
As you are only inserting new objects, you should be good to go as you are.
I am facing the same issue as it is appedning the value in the URL.
public pageReference saveRec(){
if(recCount < 6 ){
work.Employer__c = workHistory.Employer__c;
work.Ending_Job_title__c = workHistory.Ending_Job_title__c;
insert work;
workHistoryWrapperList.clear();
isDone = true;
}else
{
isDone=false;
}
if(isDone) {
pageReference pg = new pageReference(ApexPages.currentPage().getURL());
pg.setRedirect(TRUE);
return pg;
}
else{
return null;
}
}
how do I get the Billing page (or at least the Billing Lines related list) to reload automatically?
https://salesforce.stackexchange.com/questions/151973/how-to-refresh-visualforce-page-on-save-of-record
<apex:commandButton action="{!SaveAndNew}" value="Save and New"/>
https://yozanaclasses.com/7starhd-2022/
https://yozanaclasses.com/hdhub4u-2022-download-latest-bollywood-hollywood-movies-web-series/
https://yozanaclasses.com/9xflix-2022/
https://yozanaclasses.com/hdmovieshub-2022/
/https://yozanaclasses.com/vegamovies-2022/
Pickon is a Buzz Feed, Entertainment, Magazine Website, Pickon is the best website to find and share content on internet that offers content writing, entertainment news, quizzes, facts, travel blogs and viral post services to its users.
Blog: Vegamovies (https://pickon.in/vegamovies/" target="_blank)
Blog: Katmoviehd (https://pickon.in/katmoviehd/" target="_blank)