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

How to get the selected pick list values in onload method of controller?

In the pick list i have six values like 6,12,18,24,30 &36.
In VFP, if i choosed 18 it shold get it in controller's/onload method of apex class.

Can any one share the idea to get this?
Arunkumar RArunkumar R
Are you using inputField or you are generating SelectList and using the value in your visualforce page..?

Can you post code here it will be helpful to provide answer..

Anoop yadavAnoop yadav

Check the below Link with Demo.
By clicking the save Button,  you will get the selected values.
@Arunkumar R

Yes, I Created Pick list filed and loaded those values,  then i used render/re rendered  for generating it

Arunkumar RArunkumar R

Please find the below sample code,

public with sharing class PicklistController 
    public opportunity opp;
    public PicklistController(ApexPages.StandardController controller) 
         opp = (Opportunity)controller.getRecord();    
    public void selectedPicklistValue()
         System.debug('---Stage Value'+opp.StageName); 


Visualforce page:

<apex:page standardController="Opportunity" extensions="PicklistController">
 <apex:inputField value ="{!Opportunity.StageName}">
 <apex:actionSupport event="onchange" action="{!selectedPicklistValue}"/>