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 remove -None- option in picklist

Hi everyone,


   In my appliction i am using picklist field.My requirement is, in picklist i should not be display "-None-" option and it won't accept null values also.if any one knows this plz tell me the solution.


Thanks in advance,


Add required="true" attribute to your picklist tag.
In the field metadata of picklist ,try setting "first value as default value"

Thanks for ur reply,


I had already tried with the default value while creating the picklist but again -None- option is displayed.

So tell me is it possible to do this functionaility in salesforce or else can i try with Visual force pages.





Make a value the default value and make the field required=true on the page layout.

 The none option will go..



PS: try searching first, then posting questions..this q has already been solved on the forums..



Message Edited by sumita on 11-24-2009 01:15 AM

And also Anu,

Please do not post the same question on multiple posts!


Paulo CastroPaulo Castro

Hi guys,


 I tried what you suggested but I'm still getting the '-- none --' option.

 I set the inputField tag as required, the page layout field as required and set the first option as default...


 I'm using a custom page to buid this form, is that the problem??


 Tnx for any help!


 Best regards





Has anyone been able to solve this problem on a custom (VisualForce) page?  The best that I've been able to do without creating my own picklist is to set the required checkbox on the apex:inputField.  This still offers '-- None --' as an option but causes validation to fail.  Ideally, the '-- None --' shouldn't even show up.


I'd think you can do this via configuration, but, if for some reason you can't, and you're in a VF page, you can just do it yourself.


Use Javascript to take the Id of the SelectList, then go into it's SelectOption children via the DOM and remove the option that is for "None".   After all, at the end of the day it's all HTML and you can play with it via javascript.  Ugly... I'd look at configuration again.


Best, Steve.


Thanks Steve.


If it comes down to it, I'll go back to building the select list on my own using describe on the field.  Was really hoping that this simple functionality existed out of the box.




I am also frustrated at how this is not configurable through the object field. I have (like mavarette hinted) created a select list for the field using Schema.DescribeFieldResult as an alternative solution. 


If you are wandering how to do this, I have provided an example in my blog, see here:


see The Christopher Alun Lewis Blog for Salesforce news, comment and development tips and tricks



Hello All,


If anyone is still curious about how to remove the -none- option in a picklist, I have developed my solution further so that it is now contained in a re-usable Visualforce component:


See this post in my blog for more info:


see The Christopher Alun Lewis Blog for Salesforce news, comment and development tips and tricks

Alon Waisman 3Alon Waisman 3

I know it's not exactly the same, but instead of removing the '--None--', I needed to translate it to French if we were displaying the French version of a page. I wrote up some quick Javascript to do the job. Wanted to add it here in case it could help someone. You could easily change the last anonymous function to remove the option instead of changing it's text.

if ( {!isFrench} ) { translate_none_options_to_french(); }

function translate_none_options_to_french() {
     j$('option').filter(function () {return j$(this).html() == "--None--";}).each(function(index, option){option.text = '--Aucun--';})

Ivy CartagenasIvy Cartagenas
is there any new solution in removing --None-- option from the picklist?
Hi ivy Cartagenas,Paulo Castro
on Visualforce page if the field type is input field as required="true",whenever u save the record with "None" will not let u save.
if it works.please mark my answer as correct.