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
lohith mlohith m 

Pre Population in visualforce

I am new to salesforce and still learning concepts.. Can any one explain me Pre Population using VF Pages with simple understanding example... Thanks in advance.....
Pankaj_GanwaniPankaj_Ganwani
Hi lohith,

Can you please elaborate more on your concern? What you want to pre populate on the VF page? Are you looking for picklist value to be populated on vf page or simply object's field values?

Below is an example of VF page with pre population of picklist values:
<apex:page controller = "classname">
<apex:form>
<apex:selectList value="{!selected}">
  <apex:selectoptions value = "{!Options}"/>
</apex:selectList>
</apex:form>
</apex:page>

Controller:
 
public class classname
{
       public String selected{get;set;}
       public classname()
       {
        }
        public List<SelectOptions> getOptions()
        {
               return new List<SelectOptions>{new SelectOption('Yes','Yes'), new SelectOption('No','No')};
         }
}

The picklist will be populated with Yes and No values on page load.
lohith mlohith m
Thank u 
Pankaj Ganwani 3