0

I am trying to rerender an input field based on the event 'onchange' specific other input field which is of type multiselect picklist.

vf page

<apex:inputField value="{!MyObject__c.myField__c}">
<apex:actionSupport action="{!myMethod}" rerender="idToRender" event="onchange"/>
</apex:inputField>
<apex:inputField id="idToRender" value="{!MyObject__c.toBeRenderedField__c}" rendered="{!myBool}"/>

apex class

myMethod()
{
myBool = true;
}

2 Answers 2

1

<apex:inputField id="idToRender" value="{!MyObject__c.toBeRenderedField__c}" rendered="{!myBool}"/>

Instead of this you need to do this

<apex:outputpanel  id="idToRender">
<apex:inputField value="{!MyObject__c.toBeRenderedField__c}" rendered="{!myBool}"/>

</apex:outputpanel >

Because when first time page load this inputfield is rendered= false so it is not available on page so you can't rerender it. In that case we need to rerender the parent component.

0
0

It should be

<apex:actionSupport action="{!myMethod}" rerender="idToRender" event="onchange"/>

unless you also have a function that returns the string 'idToRender'

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .