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.

enhancement: delay only for invalid fields

See original GitHub issue

Versions:

  • VueJs: 2.3.3
  • Vee-Validate: 2.0.0-rc3

Description:

I’d like to have an option where only the display of ERRORS is delayed. Consider a field “email” with the validators required|email I don’t want the user to be confronted with “the email address is invalid” as soon as he starts entering a value, so I enabled data-vv-delay=“500” so that it won’t show as long as he’s typing.

This has a s trange side effect - when he does enter a valid email address, it says the email is invalid for 0.5 seconds. What I would like to see is that only errors are being delayed. So you would be validating input on every change immediately, so that when it’s entirely valid, I can update the view.

In fact - delay should ONLY happen when no errors are currently active; for these situations we don’t want the user to be bothered with the different validations while he’s still typing. As soon as he does correct the mistakes though, the validation should be updated.

I hope this makes sense.

Steps To Reproduce:

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:3
  • Comments:13 (3 by maintainers)

github_iconTop GitHub Comments

6reactions
logaretmcommented, May 22, 2017

You should either use lazy modifier on v-model for Vue bound fields, or use data-vv-validate-on="blur" which will only validate when the user leaves the input, which is more reasonable than delaying the error population.

A new but not released enhancement is to allow global setting of validation events, which enables you to set them to blur without having to add the validate-on attribute each time.

4reactions
fyodorvicommented, Jun 6, 2017

A agree with @denjaland, it makes no practical sense at all to use delay in current implementation. I reckon the only valid use of delay is actually not to bother the user with messages while he is typing. However, there’s no need to delay positive validation, it needs to be immediate, e.g. user enters invalid email, sees an error after he finished typing, goes and corrects the error, and sees the positive result immediately, otherwise it might be confusing for him.

Applying a delayed transition on an error element is an option, however error display does not limit itself to just the error element, but may include different icons, classes applied to the input, etc. It will be a hustle to put a manual css delay on all of that, and to maintain afterwards.

Lazy and blur do not cut it as well, as you get an overall input delay, and you do want on-input validation.

Read more comments on GitHub >

github_iconTop Results From Across the Web

invalid - CSS: Cascading Style Sheets - MDN Web Docs
The :invalid CSS pseudo-class represents any , , or other element whose contents fail to validate.
Read more >
Delay HTML5 :invalid pseudo-class until the first event
Since we only want to denote that a field is invalid once it has focus, we use the focus pseudo-class to trigger the...
Read more >
How to Input Validation setTimeout in Reactjs - Pluralsight
In this guide, I'll address this prevalent issue and show you a way to delay the error messages using the setTimeout function.
Read more >
User Security Configuration Guide - Cisco IOS Login ...
Login Enhancements Functionality Overview. Delays Between Successive Login Attempts; Login Shutdown If DoS Attacks Are Suspected. Delays Between ...
Read more >
Inline Validation in Web Forms - A List Apart
Of our six forms, the control version validated input only when someone ... faded after a brief delay and one that placed them...
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