Custom Dependent Picklist
You can create a custom dependent pick list in visualforce using the code below.
Vf page :
<apex:page controller="customPicklistController">
<apex:form >
<apex:pageBlock title="Custom Dependent Picklist">
<apex:pageBlockSection columns="1">
<apex:outputLabel value="State">
<apex:selectList required="true" multiselect="false" size="1" label="State" value=" {!selectedValue}" id="state">
<apex:selectOptions value="{!State}"></apex:selectOptions>
<apex:actionSupport event="onchange" reRender="city"/>
</apex:selectList>
</apex:outputLabel>
<apex:outputLabel value="Cities">
<apex:selectList required="true" multiselect="false" size="1" label="Cities" id="city">
<apex:selectOptions value="{!Cities}">
</apex:selectOptions>
</apex:selectList>
</apex:outputLabel>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
Controller :
No comments:
Post a Comment