Skip to content

Multiple error messages with Async Validators #699

Open
@kanishka-mehta-q

Description

@kanishka-mehta-q

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions