Skip to content

Debounce validation #312

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

Merged
merged 2 commits into from
Oct 12, 2017
Merged

Debounce validation #312

merged 2 commits into from
Oct 12, 2017

Conversation

icebob
Copy link
Member

@icebob icebob commented Oct 11, 2017

New formOption validateDebounceTime to debouncing the validate method:

{
    model: {
        name: "",
    },

    schema: {
        fields: [
            {
                type: "input",
                inputType: "text",
                label: "Name",
                model: "name",
                    validator: function(value, field, model){
                    return new Promise(resolve => {
                        setTimeout(() => {
                            if (value === "valid")
                                return resolve([]);

                            resolve([`invalid name: "${value}"`]);
                        }, 500);
                    });
                }
            }
        ]
    },

    formOptions: {
            validateAfterChanged: true,
            validateDebounceTime: 500
    }
}

@icebob icebob merged commit 71dd34a into master Oct 12, 2017
@icebob icebob deleted the debounce-validate branch October 12, 2017 11:47
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

Successfully merging this pull request may close these issues.

1 participant