Scrolling to error message on form

Hello,

I’ve set up a form and everything is connected and working well.

If someone does not fill in the email question, in the controller, we have a message that says Please enter a valid email address but it automatically scrolls to the top of the form rather than where the message is displayed. Is there a way through the controller to scroll to the error message?

Thanks

You can do that with JavaScript on the frontend. Check if alert container exist, then scroll to it.