I have two objects has look up realtion to each other. I have created both has picklist on VF page now I want to load one picklist values on the selection of another picklist values. Like All Sate should come on the basis of country like that. Please help, thanks in advance.
Regards Raman
This is my Code:
Congratulations
This is your Accession Page !! <apex:pageBlockSection id="detailsFacility">
<apex:selectList required="true" multiselect="false" size="1" label="Facility" style="align:left">
<apex:selectOptions value="{!FacilityOption}" />
</apex:selectList>
</apex:pageBlockSection>
public class ExtentionController
{
public string ClientSelectedValue {get;set;}
public Client__c ClientFacilityList{get;set;}
public ExtentionController()
{
}
public List<selectOption> Clientoption
{
get
{
List<selectOption> ClientName= new List<selectOption>();
ClientName.add(new selectOption('None','None'));
for(Client__c cn : [select ID, Name,ClientName__c from Client__c] )
ClientName.add(new selectOption(cn.Name,cn.ClientName__c));
return ClientName;
}
private set;
}
public List<selectOption> FacilityOption
{
get
{
string clientId = ClientselectedValue;
List<selectOption> FacilityName= new List<selectOption>();
if(clientId == '' || clientId == null)
{
FacilityName.add(new selectOption('None','None'));
}
else
{
ClientFacilityList = [select id, ClientName__c from Client__c where name =:clientId ];
for(Facilty__c fn: [select ID, Name,FacilityName__c from Facilty__c where Client__c=:ClientFacilityList.id] )
FacilityName.add(new selectOption(fn.Name,fn.FacilityName__c));
}
return FacilityName;
}
private set;
}
}