Status picklist values are : New,Pending,Closed. In onchange i am trying to pass selected picklist value . If i select New/Pending/Closed the value is passed to controller .But when i chose the Value ",'-Remove Status-" it is not passed to the controller.

vf :
 <apex:actionFunction id="passStatus" name="passStatus" action="{!passStatus}" oncomplete="test();" rerender="table,rejectReason"/> 
<apex:selectList value="{!selectedValue}" size="1" onchange="checkStatus(this);" style="height: calc(1.875rem + (1px * 2));" id="rejectReason">    
<apex:selectOptions value="{!SelectOptions}"/>                       

function checkStatus(ev){
 /*logic here*/

Apex :

 public List<SelectOption> getSelectOptions() {
    Schema.DescribeFieldResult describeResult = Account.Status__c.getDescribe();
    List<Schema.PicklistEntry> entries = describeResult.getPicklistValues();
    optionsToReturn = new List<SelectOption>();
    optionsToReturn.add(new SelectOption('','-None-'));
    optionsToReturn.add(new SelectOption('','-Remove Status-'));
    for (Schema.PicklistEntry pEntry : entries) {
        if (pEntry.isActive()) {
            optionsToReturn.add(new SelectOption(pEntry.getValue(), pEntry.getLabel()));
    return optionsToReturn;


public void passStatus() {


Please help me out !!

1 Answer 1


The first parameter is the value, the second is just the label. You need to make sure you use the correct value in the first parameter; that is the one that is sent to the controller.

optionsToReturn.add(new SelectOption('','-None-'));
optionsToReturn.add(new SelectOption('-Remove Status-','-Remove Status-'));

In this case, the first two values are represented by null and '-Remove Status-'.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .