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
Carlos HenriqueCarlos Henrique 

Getting info of fields from previous page

Hello everyone, 

i was searching one way of take selected fields to be used in next page. 
Ex.: pag1 has 3 fields, they will be selected by js and using some method keep these fields and send to the next pag2.

I can already select the fields, but i still dont know how change the page and keep the previously fields.
Unfortunately i cant use the flow because the user will select the field.

thanks in advance.
Best Answer chosen by Carlos Henrique
logontokartiklogontokartik
The easiest way I can think of is by using page parameters to pass them to the different page.

If you are using Visualforce pages and controllers, you can do is
 
PageReference nextPage = new PageReference('your page');
nextPage.getParameters().put('field1',<value>);
nextPage.getParameters().put('field2',<value>);
nextPage.getParameters().put('field2',<value>);
return nextPage;


// In the constructor of the nextPage you can retrieve them using 

Apexpages.currentPage().getParameters().get('field1');

Hope this helps

 

All Answers

logontokartiklogontokartik
The easiest way I can think of is by using page parameters to pass them to the different page.

If you are using Visualforce pages and controllers, you can do is
 
PageReference nextPage = new PageReference('your page');
nextPage.getParameters().put('field1',<value>);
nextPage.getParameters().put('field2',<value>);
nextPage.getParameters().put('field2',<value>);
return nextPage;


// In the constructor of the nextPage you can retrieve them using 

Apexpages.currentPage().getParameters().get('field1');

Hope this helps

 
This was selected as the best answer
Carlos HenriqueCarlos Henrique
Hello Buddy,

Thanks for the help @Iogontokartik. I will try this.
I will necessary i use one .js to select the values, because when the user select the option the page will save the values and send to another page. 

And, it's possible i insert methods from the controller inside of js?
Azhar Aziz GAzhar Aziz G
Hey - use the same controller for both pages. When you move one page to next page, you should set setRedirect(false). In this case It retains the values.
 
PageReference pr = new PageReference('next page');
pr.SetRedirect(false);

return pr;
Thanks.
 
Carlos HenriqueCarlos Henrique
Thank you guys! This helped me a lot :)
logontokartiklogontokartik
Glad was able to help
logontokartiklogontokartik
Hi, Did you know i uploaded my latest pictures on my Google Drive page today?Well, I’ve uploaded it again on my Google Drive click here to view them and tell me what you think. Regards Thanks and Regards, Kartik Viswanadha @logontokartik 972.365.7780 about.me/logontokartik * - Live as if you were to die tomorrow. Learn as if you were to live forever*