Remove "-None-" value from Visualforce Page in Standard and Custom Pick List Values

Solution 

There are Two Solution to  Remove "-None-" value from salesforce standard and custom Selected Picklist field.

1) Do "Required" In Visualforce Page means Required= "true" or On Pagelayout Required CheckBox true.
2) Using Jquery

<apex:page standardController="Case">
    <apex:form>
        <script type='text/javascript' src= '//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js'>
        </script>
        <script language="javascript">
            $(function() {        
                $('select.RemoveNoneValue option[value=]').remove();       
            });
        </script>    
        <apex:inputField styleClass="RemoveNoneValue" value="{!Case.Status__c}"/>
    </apex:form>
</apex:page>


Thanks
Sumit Shukla
sumitshukla.mca@gmail.com

Comments

Popular posts from this blog

Salesforce Spring 16 Release Exam (Maintenance Exam Q&A) for Developer 201 Admin

Show Hyper Link On Add Error in Salesforce Trigger

Show the Success Message before Redirecting the Detail page on Visualforce Page