question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Scroll user to first form error @submit

See original GitHub issue

Describe the new feature you’d like

I’d love to see an option to scroll users to the first error input (if an error exists) when they submit a form. Also would like to optionally focus the input that has the error.

Looking at the docs, it looks like this can be done with some kind of custom form error handler, but it would really be appreciated if we could simply set an option like the following:

<FormulateForm
  :scroll-to-error="true"
  :focus-error="true"
>

This was also mentioned in issues #182

If you have a temporary solution to accomplish this, I imagine many others would benefit from it as well.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:4
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

5reactions
acemircommented, Oct 22, 2020

@titusdecali Nice feature request.

I also needed this feature in a project I was working on and I was able to accomplish this behavior after checking the hasValidationErrors result from a function triggered by @submit.raw as in the following example.

https://codepen.io/acemir/pen/LYZbozN

This approach has a downside because Element.scrollIntoView with the center option is not widely supported but a polyfill like scroll-into-view or scroll-behavior-polyfill can be used to overcome this limitation.

Either way it would be great to see this as a ready-to-use feature or as a plugin.

3reactions
justin-schroedercommented, Nov 23, 2020

After more thought I agree this would be a great feature — although I think it falls pretty squarely in “plugin” territory. However, the plugin ecosystem for vue formulate doesn’t really exist yet, so I created a new project board called “Plugins” where we can stash good plugin ideas for the community to build out or the maintainers of the project. So we’ll keep this open and “kind of” on the road map.

I’ve been dreaming up lots of ways to kickstart that plugin ecosystem, so more on that to come.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to scroll to the first invalid control once a form has ...
Steps to take​​ To solve the problem in question, you need to perform two things once a form has been submitted: find the...
Read more >
When form is validated, how to SCROLL to the first error ...
I need to use the standard validation plugin (http://docs.jquery.com/Plugins/Validation) but any scroller would be fine, tho I had been trying with scrollTo ( ......
Read more >
How to Scroll to the First Error On a Gravity Form
This is my Gravity Forms Scroll To The First Error function. You can add this code snippet to your theme/child theme functions. php...
Read more >
How to scroll to the first error after submit in react and redux ...
In this video we will discuss how you can scroll to the first error in form with redux forms and react.If you like...
Read more >
How to scroll down to the first form validation error when the ...
How to scroll down to the first form validation error when the form is ... scroll to the top after the submit button...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found