You need to sign in to do that
Don't have an account?
Manan_Shah
Visualforce GUI design
Hi
I am creating page using Visualforce.
i have created input field like text box.
How can I create Select list so that all values of that list box coming from Salesforce custom object.
for example country is a select box and it has values like INDIA,USA,UK etc.
In your controller, create a method for fetching the list of records from the Country object. It should look something like this:
If you are using standard controller in your page then you can bind the picklist field of your object to <apex:inputField/>. Suppose you have picklist field in your object(customObj__c) and api name is status__c, you can bind this field in page like,
<apex:inputField value=”{!customObj__c.status__c}” />
And if you are using custom controller the you need to first access the all values of that picklist field using schema of object. And then add these values to list of SelectOption type and bind in page like this,
Let the name of the list of selectOption type is myList.
<apex:selectList value=”{!selectedOption}”>
<apex:selectOptions value=”{!myList}”/>
</apex:selectList>