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

When multiple validators, ignores specified error messages #9

Open
petrgazarov opened this issue Jun 30, 2017 · 1 comment
Open

When multiple validators, ignores specified error messages #9

petrgazarov opened this issue Jun 30, 2017 · 1 comment

Comments

@petrgazarov
Copy link

When validate is used with an array, specified error messages are ignored. Instead, it's defaulting to the {field} is not valid default error message (per @PepperTeasdale 's suggestion, adding required: true solved this specific problem, but it shouldn't need that extra key)

Example schema:

{
      ageDied: {
        validate: [
          {
            ...isPresent,
            validateIf: ({ diedFromDisease }) => diedFromDisease
          },
          {
            validator: ({ ageContracted }, value) => parseInt(ageContracted) < parseInt(value),
            errorMessage: 'this field cannot be before Age Contracted',
            required: true, // to be removed
            validateIf: ({ diedFromDisease }) => diedFromDisease
          },
        ]
      },
}
@ghost
Copy link

ghost commented Oct 26, 2017

Is this still open? I ran a test and I cannot recreate the bug you are describing.

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

No branches or pull requests

2 participants