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
SanchitaSanchita 

Need to show picklist options in visualforce page

hi,

i have create an object named Post_Requirement__c. it contains various picklist with options which will be used for inserting data. I have also created a visualforce page of the same functionality. The problem is i m not getting values of the picklist options in the viusalforce page. Also please note that i do not want to fetch any record. i just want to insert record into database using these values.

 

 

Followiing is the code of VF page  

 

<apex:page standardcontroller="Post_Requirements__c"  tabStyle="Post_Requirements__c" sidebar="false" showHeader="false">
<style type="text/css">
  .button1{background-color:#FFFFFF;font-weight:bold;color:#FFFFFF;}
  .left_panel{width:50%; margin:0 10px 0 0; float:left;}
  .right_panel{margin: 0 0 0 225px;}
  .right_panel .Custom9Block {width:50% !important; float:left !important;}
  .right_panel .Custom9Block .tertiaryPalette {boder:0; border-top:2px solid #94B9D1!important; color:#27282E!important;}
   body .right_panel .Custom9Block .bPageBlock .pbBody .pbSubheader .hideListButton {background:url() no-repeat scroll 0 -11px transparent !important;}
   body .right_panel .Custom9Block .bPageBlock .pbBody .pbSubheader .showListButton {background:url() no-repeat scroll 1px -1px transparent !important;}
      
  </style>
<div style="float:left; width:100%">
 
      <div class="left_panel">
          <apex:image value="{!$Resource.background}"></apex:image>
      </div>
      <div class="right_panel">
       <body bgcolor="blue">

     <apex:form >
                   <center>
   <font size="5" face="Monotype Corsiva" color="blue"><i>Welcome To Real Estate</i></font>
   </center>
   <br/>
   <br/>
     <br/>
<center>
   <font size="3" face="Monotype Corsiva" color="blue"><i>Post Your Requirement Here</i></font>
   </center>

            <table align="center" cellpadding="15" >
        <tr><td>Select Property Type :-</td>
            <td><apex:selectList value="{!Post_Requirements__c.Property_Type__c}" multiselect="false" size="1" required="true">
            <apex:selectOptions value="{!Post_Requirements__c.Property_Type__c}"/>
        </apex:selectList></td>
        </tr>
        <tr><td>Select Transaction Type:-</td>
            <td><apex:selectList value="{!Post_Requirements__c.Transaction_Type__c}" multiselect="false" size="1" required="true">
            <apex:selectOptions value="{!Post_Requirements__c.Transaction_Type__c}"/>
        </apex:selectList></td>
        </tr>
        <tr><td>Select Purchase Type:-</td>
            <td><apex:selectList value="{!Post_Requirements__c.Purchase_Type__c}" multiselect="false" size="1" required="true">
            <apex:selectOptions value="{!Post_Requirements__c.Purchase_Type__c}"/>
        </apex:selectList></td>
        </tr>
       <tr><td>Select Country Type:-</td>
            <td><apex:selectList value="{!Post_Requirements__c.Country__c}" multiselect="false" size="1" required="true">
            <apex:selectOptions value="{!Post_Requirements__c.Country__c}"/>
        </apex:selectList></td>
        </tr>
       <tr><td>Select City Type:-</td>
            <td><apex:selectList value="{!Post_Requirements__c.City__c}" multiselect="false" size="1" required="true">
            <apex:selectOptions value="{!Post_Requirements__c.City__c}"/>
        </apex:selectList></td>
        </tr>
       
        <tr><td>Select Budget Type:-</td>
            <td><apex:selectList value="{!Post_Requirements__c.Budget__c}" multiselect="false" size="1" required="true">
            <apex:selectOptions value="{!Post_Requirements__c.Budget__c}"/>
        </apex:selectList></td>
        </tr>


    </table>
    <br></br>
 <center>     <apex:commandButton styleclass="button1" value="Post Requirement" action="{!Save}" rerender="out" style="color:white;background:red;"/></center>
   
                       </apex:form></body></div>
          </div>
         
<table align="center">
<tr><td><i><b> <font color="red">Copyright © 2000-2012 RealEstate.com, inc. All rights reserved</font></b></i></td></tr>
</table>            
</apex:page>

Best Answer chosen by Admin (Salesforce Developers) 
MagulanDuraipandianMagulanDuraipandian

Use <apex:inputField/>

 

<apex:inputField value="{!Post_Requirements__c.Property_Type__c}"/>

 

Regards,

Magulan D

Salesforce.com certified Force.com Developer.

 

SFDC Blog

 

If this post is your solution, kindly mark this as the solution.

All Answers

MagulanDuraipandianMagulanDuraipandian

Use <apex:inputField/>

 

<apex:inputField value="{!Post_Requirements__c.Property_Type__c}"/>

 

Regards,

Magulan D

Salesforce.com certified Force.com Developer.

 

SFDC Blog

 

If this post is your solution, kindly mark this as the solution.

This was selected as the best answer
SanchitaSanchita

thank you so much

Sales ConsultantSales Consultant

i dont want --None-- to be displayed in the picklist,how could i do,any means of achieving it  is really appreciated,thank you

anand rastogianand rastogi

While creating a pick list select your pick value as d first value  the None will be hide in that way