+ Start a Discussion

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

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

    <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>

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


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