I have a selectOption inside a pageblocksection as follows
<apex:page standardController="Account" extensions="MyController">
<apex:form>
<apex:pageBlock>
<apex:pageBlockSection>
<apex:selectList value="{!selectedValue}" multiselect="false" size="1">
<apex:selectOptions value="{!optionsList}"/>
<apex:actionSupport event="onchange" action="{!updateData}"/>
</apex:selectList>
</apex:pageBlockSection>
....other page block sections
</apex:pageBlock>
</apex:form>
</apex:page>
The controller for this vf page is as follows:
public class MyController {
public List<Selectoption> optionsList{get;set;}
public String selectedValue{get;set;}
public MyController() {
optionsList = new List<Selectoption>();
optionsList.add(new Selectoption('value1', 'label1'));
optionsList.add(new Selectoption('value2', 'label2'));
optionsList.add(new Selectoption('value3', 'label3'));
}
public void updateData() {
System.debug(selectedValue);
}
}
I need to use the selectedValue for some conditional operations. However I do not get any of the selectOptions values in the selectedValue.
Any idea on what is happening or if I am doing something wrong? Thanks for the help.