+ Start a Discussion
m@tT_PPMLm@tT_PPML 

None in a Picklist.

Hi everyone,

Is that possible to remove None from a picklist?
Best Answer chosen by Admin (Salesforce Developers) 
werewolfwerewolf
Yes.  You have to choose a default value for the picklist, and then make that picklist required in your page layout.  That will make None go away.

All Answers

werewolfwerewolf
Yes.  You have to choose a default value for the picklist, and then make that picklist required in your page layout.  That will make None go away.
This was selected as the best answer
Paulo CastroPaulo Castro

Hi 

 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

 

 PH


BV1978BV1978

Paulo,

 

I am having exactly the same problem as you, did you ever find a solution and/or work around?

 

- Brandon 

Paulo CastroPaulo Castro
Actually, no... It is still showing none option.
KitaSanKitaSan
Once "--None--" has been removed, is it possible to add it back? 
werewolfwerewolf

Presumably by unrequiring it and removing its default None will reappear.

 

My answer above did not necessarily apply to Visualforce pages -- for questions on the behavior of inputField you should post on the Visualforce development board.

Christopher_Alun_LewisChristopher_Alun_Lewis

If you are using visualforce pages and inputFields, a solution to this is to use Schema.DescribeFieldResult to retrieve the object field picklist values, and then set up a select list and select options collection based on the retrieved info. 

 

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

http://christopheralunlewis.blogspot.com/2010/10/creating-picklist-in-visualforce-page.html

 

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

sf_evolutionsf_evolution

Hi-

I know I'm coming late, but I got it to reappear by deleting the default value, and then adding the value back.

 

I'm assuming it's a meta data update issue of some kind.

 

Subramani_SFDCSubramani_SFDC

add this script and call this class in the vf picklist value

 

<script type='text/javascript' src='//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js'>
</script>
<script language="javascript">
$(function() {
$('select.RemoveNone option[value=]').remove();
});
</script>

smaheshwari1@kedrionusa.comsmaheshwari1@kedrionusa.com

My picklist field is a dependent picklist on checkbox. It has two values. If the checkbox is clicked it should be one of the two values. But it shows none also as an option. I am on professional edition. I have made the dependent field required on page layout  and selected one of the values as default but still none appears in the picklist values.How can i solve this

 

Subramani_SFDCSubramani_SFDC

add this Javascript and call as styleclass="RemoveNone"

 

<script type='text/javascript' src='//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js'>
</script>
<script language="javascript">
$(function() {
$('select.RemoveNone option[value=]').remove();
});
</script>

 

 

 

<apex:inputfield value="{!somevalue}" onchange="someevent" style="width:80px"  styleClass="RemoveNone" id="id"/>

 

 

 

Subramani

Cloudcredence technologies

smaheshwari1@kedrionusa.comsmaheshwari1@kedrionusa.com

But I am on professional edition in salesforce. I cannot have apex class