Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple error messages with Async Validators #699

Open
kanishka-mehta-q opened this issue Dec 15, 2020 · 1 comment
Open

Multiple error messages with Async Validators #699

kanishka-mehta-q opened this issue Dec 15, 2020 · 1 comment

Comments

@kanishka-mehta-q
Copy link

kanishka-mehta-q commented Dec 15, 2020

Multiple error messages are coming when using Async Validator.

Version of Vue-form-Generator used : 2.3.4

Issue : One custom async validator is added to the field and API is integrated on that validator but on every key press if field is invalid, error messages keeps pushing into the array and though multiple error messages are coming below field.

Expectation : On key press if error already exists in the array, it should not be pushed again.

Example :

isNameExists(value) {
return await new Promise((resolve) => {
HTTP.get("/nameExits=" + value)
.then((response) => {
resolve(["Name not exists"]);
})
.catch((e) => {
resolve();
this.errors.push(e);
});
});
},

isNameExists is custom validator. Error message "Name not exists" keeps on repeating".

Note : Error keeps on repeating in slow network, for fast network it is working fine.

@icebob Please look into this.

Thanks in advance

@indra2-chatterjee-q
Copy link

I have been encountering a similar issue, it is yet not a blocker as duplicate error messages do not happen every time, but sometimes the same error keeps repeating.

Just to add, the API call to check the value and respond from server, happens on each key up event. This is not the case if I check the value once the form is submitted, but then that adds up to a delayed user experience.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants