I have an InputField, when the length of the String entered in the InputField becomes 0, it should display a toast and on closing the Toast, the Focus should come back to InputField?

Here I am able to display a Toast Properly but due to toast, I am losing focus from the InputField?


You have a duration attribute in lightning toast method. Once the toast method is fired using. toastEvent.fire();

you can use javascript setTimeout method of the same duration and In that method, you can use javascript to set focus on particular input with particular id like this.


or you can use cmp.get("v.Input"); to get the input and set it focus in similar way.

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.