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
nitin sharmanitin sharma 

VF page with SelectList options

Hi I am trying to understand below given code from teh visual force book.I am stuck at one place and i do not find information on that.

I am struggling to understand the lines underlined in the code:-

1) What does filterid signify here.I assume it should either be a method of the case class or some variable.I am not sure what it s.if it is one of these then where can I get information about them.

<apex:selectList value="{!filterId}" size="1">

2) I do  not understand {!listviewoptions} options .Can somebody please help?

<apex:selectOptions value="{!listviewoptions}"/>

<apex:page standardController="Case" recordSetvar="cases">
        <apex:form id="theForm">
            <apex:panelGrid columns="2">
                <apex:outputLabel value="View:"/>
                <apex:selectList value="{!filterId}" size="1">
                    <apex:actionSupport event="onchange" rerender="list"/>
                    <apex:selectOptions value="{!listviewoptions}"/>
                <apex:dataList var="c" value="{!cases}" id="list">
Slava RamSlava Ram
It works exactly like expresion language in java. Value attributes are populated during compaling with values from the controller class. For example: 
value="foo" may be (depending on visualforce element):
- class property (public List<Opportunity> { get; set; }),
- class member (public final static String foo = 'foo';),
- class method (private Boolean getFoo() {...}).

In this case selectLists value is an list of SelectOption objects. And listviewoption is a String class property with setter. 
(And more! Each time a select list value changes on page, property takes this new value. So you can assign values to a class properties throug page.)
 select list and selection options together are used for creating picklist field.

<apex:selectList value="{!filterId}" size="1">
                    <apex:actionSupport event="onchange" rerender="list"/>
                    <apex:selectOptions value="{!listviewoptions}"/>

The varibale 'listviewoptions' will all the picklist values in controller. and variable 'filterId' will hold the picklist value which you select in VF page.