Skip to main content

Posts

Showing posts with the label required attribute is not working for selectlist

How to use required attribute in picklist as like salesforce standard?

There is an attribute called Required which can be used in almost all visual-force component.If we use that attribute then red color mark will be appended with the field and if we don't enter any value ,try to save,then it shows one error(You must enter some value) just below to that field.  For example:- <apex:inputField value="{!account.Industry}" id="field1" required="true" />  Here Industry is a standard pick-list, if we write required = true, red mark is coming,however if we are making pick-list in controller and displaying using <apex:selectlist> and <apex:selectoptions> then red won't be displayed.  <apex:selectList label="Picklist" multiselect="false" size="1" required = "true" >                <apex:selectOptions value="{!options }">                   </apex:selectOption...