+ Start a Discussion
Adil AleemAdil Aleem 

Rerendering Component's Content based on another Component

I want to change component contents(using rendered for a outpanel) based on the value of another component's input field.I am using using both the component in one VF page.

Provide me the solution so that I can rerender(ajax) the component's content based on the value of another component's input field. 
Please go through the help & Training link to understand how you can rerender a specific part of VF page - you can make use of ID attribute so as to identify the component in context:

sam sammsam samm
The Easiest way to do is using javascript rather then rerendering the outputpanel.
Adil AleemAdil Aleem
You are not getting my point.I am using 2 visualforce components in a Visualforce Page.


<c:component1 ....... />      // Component 1
<c:component2 ....... />      // Component 2


My question is I want to rerender component2 when componet1's field changes.How can I generate an event(onchange) if any part of VF component changes in VF page. 
sam sammsam samm

For acheiving this you need to add a flag in component 2 which help in rendering the component2.

<apex:attribute name="component2_render" type="boolean" description="renders this component" />

onchange of component 1 add a flag in controller make it true then use this flag to rerender component 2.
<c:component2 component2_render="{!your flag in controller}" ....... />
Hope this helps!