Removing None Option in PickList visualforce apex

2019-07-19 07:28发布

问题:

i have created an object with name PS_Detail__c .in this custom object i created a custom field .in this picklist i defined two values Dollar ,Unit. when i go to P/S Detail Tab for creating a new PS_Detail__c object then i get None also as a value in picklist field .i want only Dollar and Unit as Picklist values .some one please help how to remove this None from Picklist !!

回答1:

As you have discovered, you cannot make this picklist required at the object level. However, making this field required on the page layout will remove the -None- option from the available options.

To do this, edit the page layout on your object and select the wrench icon next to your field:

Then, you should be able to check the "Required" box in the dialogue box that pops up: