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


I was trying to call the click() function, when a value is selected in the selectoption.


But I dont see the call going through, I see the javascript function being call and than call goes to apex:function.

In the debug I can see getStageValue() called again on selecting value in selectoption.  Is the selectoption stopping the call?

 I tried action support and it doesnt work, I think this is a salesforce bug. I tried several options and it does not work.Looks like apex:selectoption and action functions have an issue when used together.


<apex:page standardController="Opportunity" extensions="Test">
  <script type="text/javascript">
            function getStageValue(id){
  <apex:form >
      <apex:actionFunction action="{!click}" name="displayFunction"  rerender="pageblock">
                <apex:param name="stageValue" value=""/>
      <apex:pageBlock  id="pageblock">
            <apex:outputlabel value="Stage:" />
            <apex:selectList value="{!stage}" multiselect="false" size="1" id="stageValue" onchange="getStageValue('{!$Component.stageValue}')">
                <apex:selectOptions value="{!StageValue}" />


public with sharing class Test {
        private final String procName;
        private final Opportunity opp;
        String [] stage = new String []{};
        public Test(ApexPages.StandardController stdController) {

        System.debug('Called LSOpportunityDetailsController CTOR');
        String i = stdController.getId();

            this.opp = [select id, name, ProcessId__c from Opportunity where id = :i];        
            if (opp.ProcessId__c != null) {
                procName = [SELECT Name FROM Sales_Process__c where Id=:opp.ProcessId__c].Name;
    public String[] getStage(){
        return stage;
    public void setStage(String [] stage){
        this.stage = stage;
    public  List<SelectOption> getstageValue(){
        List<SelectOption> options = new List<SelectOption>();
        List <Phase__c> phaseList = [select Name from Phase__c where Sales_Process__c=:opp.ProcessId__c  Order by Order__c];
        for(Phase__c phase:phaseList){
                options.add(new SelectOption(phase.Name,phase.Name));
        return options;
    public void click(){
        system.debug('In -------------->');