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

Passing attribute of one custom component to another custom component
I have 2 custom components that each include a select box. I would like to have the first pass its value to the second so that it can change the choices based on the value it is passed. How would I go about passing the value to the second component?
Hi,
What I understand from your requirement is that, you have two separate components and the one component is dependent on the updated value from the other component.
So, let me know if the below provided solution works for you:
Extension: SharedClass
VF Page
ComponentA
ComponentB
All Answers
Hi,
Create an extension class which will be included in the page in which you are using 2 custom components. Bind the field values for both the components with this class and then share the instance of extension using the component attribute, by this way you can access the field values of both the components from each other.
Make sure that you rerender the other component after changing value from one component.
I hope this solution helps!
Important :
Hit Kudos if this provides you with useful information and if this is what you where looking for then please mark it as a solution for other's benefit.
Thanks,
Neeraj
Thanks Neeraj.
I tried something similar using the page's controller to do the variable passing, but it didn't work. Below is the snippet for the page and its controller. fieldName and searchFor are attributes of the SearchLookup controller. Where am I going wrong?
Hi,
What I understand from your requirement is that, you have two separate components and the one component is dependent on the updated value from the other component.
So, let me know if the below provided solution works for you:
Extension: SharedClass
VF Page
ComponentA
ComponentB
Worked great. Thanks so much.