Skip to content
This repository has been archived by the owner on Dec 25, 2017. It is now read-only.

Asynchronous validator should perform validation after user has finished the input #58

Closed
Haixing-Hu opened this issue Sep 22, 2015 · 1 comment

Comments

@Haixing-Hu
Copy link

I have a form for registering new users. The form has a username field, and I use a asynchronous validator to validate whether the username exists (as described by the example in the README.md).

The problem is, the validator will try to validate as soon as the user enter a single letter. This will cause the server receives too many requests.

Is there any way to make the asynchronous validator perform the validation after the user has finished the input? That is, the validation should be performed after the input focus leaving the username field.

Thanks in advance.

@kazupon
Copy link
Owner

kazupon commented Sep 24, 2015

Sorry for late reply.

One solution, You can achieve your asynchronous validator by using debounce param.
http://vuejs.org/guide/forms.html#Input_Debounce

The following example:
http://jsfiddle.net/kazupon/cm6uzjbb/2/

However, this solution is based with user input event, this solution may not be what you want.
I think that consider this issue as the development candidate of V2.

@kazupon kazupon mentioned this issue Sep 25, 2015
14 tasks
@kazupon kazupon added the 2.0 label Oct 26, 2015
@kazupon kazupon added this to the v2.0 milestone Nov 8, 2015
@kazupon kazupon removed the 2.0 label Jan 16, 2016
kazupon added a commit that referenced this issue Feb 27, 2016
kazupon added a commit that referenced this issue Feb 27, 2016
kazupon added a commit that referenced this issue Feb 27, 2016
kazupon added a commit that referenced this issue Mar 12, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants