+ Start a Discussion
SFDC coderSFDC coder 

Retain values on VF page after navigation


I have a VF page say for eg: Page1 ,a text field T1 and a custom button btn1.
-User enters some text in T1 and navigates away by clicking on button btn1
-There after user is redirectted to Page Page2 and after he clicks on button btn2
-he again comes back to Page Page1.

Now the challenge is when he comes back to Page1, the text he entered in textfield T1 is lost. So how do i reatain this value for the end user?

I have separate controller for page2.So is that possible to retain such values even if my pages dont share the same controller?
Also i cant use passing params through url,since in my real scenario i have to deal with lists instead of a text field,

Any help would be highly appreciated
Pradeep Kumar L.GPradeep Kumar L.G
You can make use of single controller and two VF page and in pageReference use setredirect=false, this will help what your are looking for.

Pradeep Kumar L.G

Check if Following approach works for you - 
1) create a new field in sf for page1 text field T1 and bind this field with page1's T1 field.
2) insert/update T1 into SF on btn1 click.
3) because you have inserted T1 and you bind it with SF field, it will automatically populate when you go back to Page1 from page2.

Santosh Chitalkar