You need to sign in to do that
Don't have an account?

Passing/accessing parameters on another controller
Hello
I have this case which I can't figure out:
I have two pages each with a different custom controller.
I want to access variables on PageA controller from PageB controller.
Is there anyway to achieve this?
Thanks
Oded
Oded,
Your requirement is bit different. As 2 pages are accessible as 2 seperate tabs, various scenarios are possible.
User go to PageA and then to PageB or viceversa. It's quite possible that user may go to some different tab in between. So anything stored as an variable in controller will not be accessible on other tab. That's why I suggested you to use cookie which will be available thoughout that session.
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_classes_sites_cookie.htm
Let me know if you need additional help.
Regads
G
All Answers
If your control/flow of pages is from PageB to PageA, then you can pass parameters on querystring like :
apex/PageA?Param1=abc
In your PageA Controller you could access Param1 using currentParameter.
Hi
In my case these two pages make up two tabs, so the order is not predefined.
I need to be able to access each from the other.
I thought to maybe use and extension controller but I'm not sure it will work and maybe there is a better practice?
Any advice?
Oded
If order is not predefined, then why don't you use cookie to store this data. Whichever page is clicked first will validate if cookie exists and set value accordingly. Same value will be available in other tab/page whenever user clicks on it.
I've never used cookies so it didn't occur to me to use it for this case.
I'll go an learn the issue and try it out.
Thanks a lot
Oded
Oded,
Your requirement is bit different. As 2 pages are accessible as 2 seperate tabs, various scenarios are possible.
User go to PageA and then to PageB or viceversa. It's quite possible that user may go to some different tab in between. So anything stored as an variable in controller will not be accessible on other tab. That's why I suggested you to use cookie which will be available thoughout that session.
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_classes_sites_cookie.htm
Let me know if you need additional help.
Regads
G