+ Start a Discussion
Adil_SFDCAdil_SFDC 

Pass selectList Parameter to Controller



Hi I need to get the selected value in my param that needs to be passed to the controller. right now my apex parameter value is hard coded to 06 any help

<apex:sectionHeader title="Field Researcher Schedule for Region" />

            <apex:selectList value="{!contactSalesRegion}" size="1" multiselect="false">
                <b>Field Researcher Schedule for Region</b>
                <apex:selectOptions value="{!SalesRegionsCoveredValues}"></apex:selectOptions>
                <apex:actionSupport event="onchange" action="{!salesRegionCoveredFilter}" reRender="dataBlock">
                    <apex:param name="salesRegionId" assignTo="{!salesRegionId}" <strong><em><u>value="06"</u>></em></strong></apex:param>
                </apex:actionSupport>
            </apex:selectList>
            
            <apex:outputPanel id="dataBlock">
            <apex:pageBlock >
					 
        
                        <b>Scheduled Date</b>
                   
                <table class="list" border="0" cellpadding="0" cellspacing="0">
public class PhotoSchedulerController {

    public String salesRegionId { get; set; }
    public String ContactSalesRegion {get;set;}
    public List<Contact> contactsToDisplay {get;set;}
        
    public void salesRegionCoveredFilter() {
    	
        system.debug('sales Region ID:'+salesRegionId);// HERE I NEED  SELECTED VALUES FROM PICK LIST
       // getDataRows();
    }
    

    public  List<SelectOption> getSalesRegionsCoveredValues() {
       List<SelectOption> options = new List<SelectOption>();
       Schema.DescribeFieldResult salesRegion = Contact.Sales_Regions_Covered__c.getDescribe();
       List<Schema.PicklistEntry> salesRegions = salesRegion.getPicklistValues();
       for(Schema.Picklistentry entry : salesRegions){
            options.add(new SelectOption(entry.getLabel(),entry.getValue()));
        }
        return options;
    }



Prady01Prady01
Hi this is the vf page code
<div class="dropdownContainer">
          <apex:selectList value="{!datacatForinsert}" size="1" styleClass="dropDown">
           <apex:selectOptions value="{!dataCat}"/> </apex:selectList>
  </div>
This is how I get the selected value of the picklist in the apex controller
public with sharing passVal{
public string datacatForinsert{get;set;}
	public passVal(){
		system.debug('this will give you the selected value of the picklist '+ datacatForinsert)
	}
}
Hope this helps!
Prady