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
Darshit Pathak 3Darshit Pathak 3 

SelectList value not getting in Apex controller

VF Page: 
<apex:selectList styleclass="slds-select" value="{!EditOrSave}"  size="1">
                                <apex:actionSupport event="onchange" action="{!redirectToEditOrDetail}" reRender="">
                                    <apex:param name="recId" value="{!bscheduleRecord.Id}" assignTo="{!recId}"/>
                                </apex:actionSupport> 
                                    <apex:selectOptions value="{!selectOptionEditSave}"/>
                                </apex:selectList>

Controller:
public String EditOrSave{get;set;}
 public PageReference redirectToEditOrDetail(){
    System.debug('***EditOrSave: '+EditorSave);     
    }

But I am getting blank value on changing picklist value.
sfdcMonkey.comsfdcMonkey.com
hi Darshit,
here is the sample code for your requirement : you don't have need to use <apex:param /> in your code
<apex:page controller="sample" id="mypage">
    <apex:form >           
       
        <apex:selectList id="selected_list" value="{!temp}" required="false" size="1">
            <apex:selectOption itemvalue="None" itemLabel="--None--"/>
            <apex:selectOption itemvalue="a" itemLabel="a"/>
            <apex:selectOption itemvalue="b" itemLabel="b"/>
            <apex:actionSupport event="onchange" reRender="Details" action="{!find}"/>
        </apex:selectList>
        <br/>
        <apex:panelGroup >       
            <apex:outputPanel id="Details">           
                The value based on select list value: {!temp1}           
            </apex:outputPanel>
        </apex:panelGroup>
        
    </apex:form>
</apex:page>
apex controller
public class sample
{
    public String temp {get; set;}
    public String temp1 {get; set;}

    public sample()
    {

    }
   
    public void find()
    {
        if(temp == 'a')
        {
            temp1 = 'Welcome';
        }
        else if(temp == 'b')
        {
            temp1 = 'Thank you';
        }
    }           
}

output "

User-added image

i hope it helps you.
      Let me inform if it helps you and kindly mark it best answer if it helps you so it make proper solution for others
    thanks
sfdcmonkey.com
Darshit Pathak 3Darshit Pathak 3
param is used for different purpose. That value I am getting in the controller.
But the value of select list I am not getting.
Rajesh3699Rajesh3699
Below code might help you,
Public List<SelectOption> getSelectOptionEditSave(){
    list<selectOption> lt = new list<selectOption>();
    lt.add(new selectOption ('Save', 'Save'));
    lt.add(new selectOption ('Edit','Edit'));
    return lt;
}}

also...the selectOptions should come below the selectOptions.