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

how to show error on lightning:button
Hi all,
I had created ligtning button in uising lightning:button and i want to show error on it.
Anyone know how to do it?
I tried this but it dosen't work
Thanks in advance
I had created ligtning button in uising lightning:button and i want to show error on it.
Anyone know how to do it?
I tried this but it dosen't work
var op = component.find("button1"); op.set("v.errors", [{message:"Select any one option"}]);
Thanks in advance
If you want to display an error message you can do it by making an boolean attribute(default is false) true on button click in the javascript controller and set whatever message you want to display in "yourMessage" attribute as i have done in the code below.
Hope this helps. Do let me know if you have any queries.
P.S: Please mark this as solved if this helped you.
Regards
Shubham Kumar
You can use the below code.
<<<----Lightning Component----->>>>
<<<<---Controller----->>>> I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Ajay Dubedi
www.ajaydubedi.com