+ Start a Discussion
JaanuJaanu 

How to make the picklist field is required in Lightning component ?

I have a picklist field valid values are A, B or C. I am using this field in lightning component. When the screen presented, the default value should be "None". If user is not chaning this picklist field to valid value - A, B or C, system throw an error message it's required field and valid values are A, B or C. How to acheive this functionality ?

Pls note that "None" is not a valid picklist value... but the field should be set to "None" when the screen comes up. 
Best Answer chosen by Jaanu
Deepali KulshresthaDeepali Kulshrestha
Hi,

Using the lightning: Select component, there is a required attribute

<aura:component>
    <lightning:select name="select1" label="How many tickets?" required="true">
        <option value="">choose one...</option>
        <option value="1">one</option>
        <option value="2">two</option>
        <option value="3">three</option>
    </lightning:select>
</aura:component>

I suggest you go through this link, it will help :

https://developer.salesforce.com/docs/component-library/bundle/lightning:select/example

I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

Thanks and Regards,
Deepali Kulshrestha