You need to sign in to do that
Don't have an account?

messageWhenValueMissing not working for lightning:input type='date'
<lightning:input aura:id="startDate" type="date" name="startDate" label="Date" messageWhenValueMissing="You must specify Date" required="true" />
But it always showing message ="Complete this field." And If I change type="text" it works perfectly.
Though not entirely sure about why the 'messageWhenValueMissing' is not working for Date type fields, Workaround for this is as below:
Please let me know if this helps.
Lokesh
You can go with javascript to validate your input fields.Try the bellow code it works fine with your requernment: you can prefer the link for more Update:
https://www.w3schools.com/js/js_validation_api.asp
I hope you find the solution helpful. If it does, please mark as Best Answer to help others too.
Thanks,
Ajay Dubedi
Hi Banshi Lal Dangi,
What's the version of your lightning component? I have tried the same it shows correctly

Code:
<lightning:input aura:id="startDate" type="date" name="startDate" label="Date"
messageWhenValueMissing="You must specify Date" required="true" />
We have version 47
Thanks,
Pavithra P