+ Start a Discussion
Deepak ChouhanDeepak Chouhan 

visualforce

Hi,
I have create a picklist and fieldset. i want to control fieldset by picklist without page reload when i will change the picklist value fieldset must be change.

pls help me out
Suneel#8Suneel#8
You can change the FieldSets based on the picklist value as below. Hope this helps
<apex:repeat value="{!$ObjectType.Account.Fieldsets.Fieldset1}" var="f" rendered="{!selectedPicklistValue=='picklistvalue1'}">
                <apex:pageBlockSection >
                <apex:outputField value="{!account[f]}" />
                </apex:pageBlockSection>
            </apex:repeat>
            <apex:repeat value="{!$ObjectType.Account.Fieldsets.Fieldset2}" var="f" rendered="{!selectedPicklistValue=='picklistvalue2' || selectedPicklistValue=='picklistvalue3'}">
                <apex:pageBlockSection >
                <apex:outputField value="{!account[f]}" />
                </apex:pageBlockSection>
            </apex:repeat>
Deepak ChouhanDeepak Chouhan
Hi, Suneel
Thanks for Reply
I have done this above part. but it's not working in my page.

<apex:repeat value="{!productType}" var="pv"> //picklist
    <input type="button" value="{!pv}"/>   
</apex:repeat>

<apex:repeat value="{!$ObjectType.Product__c.FieldSets.Product_Section1}" var="p" rendered="{!productType=='Mobile'}" >
    <div class="radio-block" >
        <apex:inputfield value="{!new_pro[p]}"/>
        <span class="lbl">{!p.label}</span>
    </div>
</apex:repeat>
<apex:repeat value="{!$ObjectType.Product__c.FieldSets.Product_Section2}" var="p" rendered="{!productType=='Watch'}" >
    <div class="radio-block" >
        <apex:inputfield value="{!new_pro[p]}"/>
        <span class="lbl">{!p.label}</span>
    </div>
</apex:repeat>
 
Suneel#8Suneel#8
Below is the complete code including action support mark up.Can you explain what you mean by "it is not working".What exactly is happening?
    <apex:page standardController="Account" extensions="FieldSetController">
    <apex:form id="theForm">
    <apex:selectList value="{!picklistValue}" size="1">
        <apex:selectOption itemValue="FieldSet1" itemLabel="FieldSet1" />
        <apex:selectOption itemValue="FieldSet2" itemLabel="FieldSet2" />     
        <apex:selectOption itemValue="FieldSet3" itemLabel="FieldSet3" />           
        <apex:actionSupport event="onchange" reRender="theForm" />
    </apex:selectList>
    <apex:outputPanel >
        <apex:pageBlock >
            <apex:repeat value="{!$ObjectType.Account.Fieldsets.Fieldset1}" var="f" rendered="{!picklistValue=='FieldSet1'}">
                <apex:pageBlockSection >
                <apex:outputField value="{!account[f]}" />
                </apex:pageBlockSection>
            </apex:repeat>
            <apex:repeat value="{!$ObjectType.Account.Fieldsets.Fieldset2}" var="f" rendered="{!picklistValue=='FieldSet2' || picklistValue=='FieldSet3'}">
                <apex:pageBlockSection >
                <apex:outputField value="{!account[f]}" />
                </apex:pageBlockSection>
            </apex:repeat>
            </apex:pageBlock>
    </apex:outputPanel>
    </apex:form>
</apex:page>

 
Deepak ChouhanDeepak Chouhan
Hi Suneel,

Actually we have crated product object which have contain soo many fields with picklist or multipick list and so on and we have created some fieldset based criteria we want to show on picklist value. but picklist show in button format and checkbox which have controlling some other field. so i want to controlle fieldset on picklist values but picklist show in button format.
Suneel#8Suneel#8
Can you post your full code