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

Is it possible to create custom validators ? and create validator for, eg, two fields ? #178

Open
julestruong opened this issue Mar 31, 2016 · 2 comments

Comments

@julestruong
Copy link

No description provided.

@julestruong
Copy link
Author

never mind i found how :

validators: [(form, field, callback) => {
                if (field.data !== "ok") {
                    callback("msg error");
                } else {
                    callback();
                }
            }]

U may want to add this in documentation :)

but still i would love to know how to combine validations for a whole form

@ljharb
Copy link
Collaborator

ljharb commented Mar 31, 2016

A PR to improve the documentation is always welcome!

Validations are performed per-field - you can certainly reuse a validator on as many fields as you like by storing the function in a variable, and passing that variable into multiple fields.

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