Skip to content

Allow custom validator to return an error string#8

Open
kohenkatz wants to merge 1 commit intoJohnKimDev:masterfrom
kohenkatz:patch-1
Open

Allow custom validator to return an error string#8
kohenkatz wants to merge 1 commit intoJohnKimDev:masterfrom
kohenkatz:patch-1

Conversation

@kohenkatz
Copy link

Example:

This custom validator allows checking if a password field and password_confirmation field have the same value.

req.validate({
    password: (val) => (val === req.param('password_confirm') ? true : 'password and confirmation must match'),
});

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