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

Render fields based on picklist value
Any help would be appreciated. I'm trying to get a field to render based on a picklist value seleciton but I can't seem to get it to work. Here's my VF code (I'm not using a controller).
<apex:page standardController="Opportunity">
<apex:form >
<apex:pageBlock id="thePageBlock">
<apex:pageBlockSection columns="2">
<apex:inputfield value="{!Opportunity.Type}" id="Type">
<apex:actionSupport event="onchange"
rerender="ProdFamilyModel"/>
</apex:inputfield>
<apex:inputfield value="{!Opportunity.Fiscal_Booking_Date__c}"/>
</apex:pageBlockSection>
<apex:outputPanel id="ProdFamilyModel" rendered="{!IF(Opportunity.Type != 'Test', true, false)}">
<apex:pageBlockSection columns="2" id="ProdFamily">
<apex:inputfield value="{!Opportunity.Product_Family__c}"/>
</apex:pageBlockSection>
</apex:outputPanel>
</apex:pageBlock>
</apex:form>
</apex:page>
What am I doing wrong?
Sometimes, if you have any of the required fields in your visuaforce page, then none of the actions(It may be actionsupport,commondbutton, commandLink, etc) are invoked.
So, always have a pages message and rerender that to find whether you are hitting required field issue.
I have used actionRegion tag in your code, check if this helps you. If not then let me know what didn not worked.
Note: Use Insert code button from rich text panel for inserting your code next time along with proper intendation(It helpful for us to read your code :) ).
All Answers
Sometimes, if you have any of the required fields in your visuaforce page, then none of the actions(It may be actionsupport,commondbutton, commandLink, etc) are invoked.
So, always have a pages message and rerender that to find whether you are hitting required field issue.
I have used actionRegion tag in your code, check if this helps you. If not then let me know what didn not worked.
Note: Use Insert code button from rich text panel for inserting your code next time along with proper intendation(It helpful for us to read your code :) ).
Hey, Rahul. Thanks for your help. I used you code and it didn't work. As well, I didn't get a failure mesage either.
In this case, the component is not already loaded in DOM and you are trying to rerender that component(which is not in dom).
To overcome this make outer panel Rendered and rerender inner page block section.
I have updated the code in my earlier post. Check it out.
Hey, Rahul. Sorry, still no luck. :(
Please check if you have value as 'Test' in the Opportunity Type picklist.
It wasn't working for me yesterday but it works this morning.
Thanks a bunch for your help, Rahul. You are a life saver!!!
Hi there,
I am having same issue. I have tried to do the same thing but it is not working, you can review my code and pls suggest me a solution soon.