Hi guy's I have made a form using react and material UI and I would like to move focus to those input fields which are missing values.
I am highlighting those fields that are missing an input value but what I would love to do is take the focus to that particular input field. In the above example last name, date of birth, monthly income and PAN number are missing. I would like the focus to be on the last name field. I have tried using the following piece of code to focus on a particular input field but it isn't working as I would expect it to work.
autoFocus={!firstName}
So that if first name is not available the focus should go to first name input field but it hasn't worked like I had expected it to be. For individual input fields if I use autofocus it works fine. What should I use if I have multiple input fields?
Any help or suggestion is appreciated. Thank you for your time and patience.