Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
Passing 2 variables from component to component
HKN1104
Hello
I had a requirement where we have to pass couple of variables from one component to another component.So if i use $PAGE_LINK[2nd COMPONENT NAME]VARIABLE1=
&VARIABLE2=
then this one is not working, can any one help me guys. Can any one help me guys, Reply's appreciated
Find more posts tagged with
Comments
miroperez
Sitepub doesn't currently support component to component communication. If you need to build DOM structures in one component based off another component, the only way to do this is to create some sort of client side eventing mechanism which allows one component to fire events that other components respond to. For example, once comp A and comp B are rendered, click on something in comp A might fire a client side event which comp B is listening for. When comp B receives the event, it can do something with it. For example, comp B might invoke an AJAX handler which passes the variable received from comp A's event to the an external. The external will then return some data to comp B and it will render based on it's handler code.
Stokes
Can you define further what you mean by 'from component to component'. I find that while there's no facility for explicit component-to-component communication, there's usually a way to accomplish what you need.
Do you mean you have Page A with Component A and Page B with Component B? If so, then you can use request arguments to communicate.
Or do you mean you have a single page with Component A and Component B? If so, do you need one Component to react to the other on the initial rendering of the page? Page-scoped variables can be used for this (although you technically can't count on the order the components will get rendered in).
Or if you need the user to interact with one component in the browser and have the other be updated in the browser, then you can use Javascript. And if you need input from the server on that, then AJAX.
All that to say that there's a technology available for almost every situation, and if you can be more specific about what you're after you can get a more specific answer.
Stokes.
dobrien
The way to pre-compute information for other components to use is in a Site or Page pre-controller.
Migrateduser
"The way to pre-compute information for other components to use is in a Site or Page pre-controller."
has this been done before? Can you please let me know how?