function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
TechnosTechnos 

Select the data of one picklist on the basis of another picklist

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

Sonam_SFDCSonam_SFDC

Hi Technos,

 

If these picklists are on the same Object, you can use dependent picklists and use them on the Visualforce page.

 

For your reference:

http://www.salesforce.com/us/developer/docs/pages/Content/pages_quick_start_dependent_picklists.htm

TechnosTechnos

Thanks for reply Sonam, But these are different objects

 

regards

Raman

TechnosTechnos

I  tried this but did not get the solution ::

 

 <apex:page Controller="ExtentionController"  >
     <apex:form >
          <apex:pageblock title="Hello {!$User.FirstName}!" >
              <h1>Congratulations</h1>
              This is your Accession Page !!<p/>
              <apex:pageBlockSection >
  <apex:selectList required="true" multiselect="false" size="1" label="Clients"  style="align:left" value="{!ClientselectedValue}">
                    <apex:actionSupport event="onchange"   reRender="detailsFacility"/>
                    <apex:selectOptions value="{!Clientoption}"/>
                </apex:selectList>

               <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>
 </apex:pageblock>
      </apex:form>
</apex:page>

 

    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;
       }
    }

 

 

Please help, FYI, Both Clinet and Facility are Different object