I want to load one page block section on the same VF Page only after the user select the value in the Picklist(which is on the same VFPage). I have used render and reRender option but it does not work for me as I guess that needs value submitted first for the picklist and than after it can affect.
I am creating VFPage for opportunity edit Screen. So I want user to only add date in certain fields if the previous pick-list is selected as yes.
I have also refered to this post here How to hide a section in visualforce page onchange of picklist element
but it is not loading page block section after I change the picklist value to yes. It seems I will required to do this through AJAX. but I don't know how.
Can anyone please help with this ?
My code snippet
<apex:page standardController="Opportunity" sidebar="true" showHeader="true" extensions="Opp_edit" id="page" tabStyle="Opportunity" action="{!doLoad}">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.js" type="text/javascript">
</script>
<apex:pageBlockSection>
<apex:pageBlockSectionItem >
<apex:outputLabel value="Electricity" for="Elec"/>
<apex:inputField value="{!opportunity.Electricity__c}" id="OppElectricity">
<apex:actionSupport event="onchange" reRender="SectionID" id="AS"/>
</apex:inputField>
</apex:pageBlockSectionItem>
<apex:pageBlockSection>
<apex:pageBlockSection title="SectionB" columns="2" id="SectionID" rendered="{! opportunity.Electricity__c=='yes'}">
<apex:pageBlockSectionItem></apex:pageBlockSectionItem>
<apex:pageBlockSectionItem></apex:pageBlockSectionItem>
<apex:pageBlockSectionItem></apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:page>
<apex:actionSupport>
to the picklist field that will submit the changed value to the controller using AJAX and will also re-Render the page block section.