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

V4 generateMessage not working #2893

Closed
matzeso opened this issue Sep 10, 2020 · 1 comment
Closed

V4 generateMessage not working #2893

matzeso opened this issue Sep 10, 2020 · 1 comment
Labels
🔼 v4.0 Will be handled in the next major version

Comments

@matzeso
Copy link

matzeso commented Sep 10, 2020

Versions

  • vee-validate: 4.0.0.-alpha.11
  • vue: 3.0.0-rc.10

Describe the bug
When using rules that return false, the generateMessage function from config should make sure to put the correct message in the error bag. Instead, the error is false (as if generateMessage was never declared).

To reproduce
Steps to reproduce the behavior:

  1. Go to https://codesandbox.io/s/vee-validation-v4-generator-y7v7i?file=/src/main.js
  2. Type anything into text field
  3. See "false" printed

Expected behavior
The demo code taken from https://vee-validate.logaretm.com/v4/guide/i18n#global-message-generator says that by configuring generateMessage with a custom message, it would show that message instead.

Demo link
https://codesandbox.io/s/vee-validation-v4-generator-y7v7i?file=/src/main.js

I really like your work on v4 so far, keep up the great work :-)

@logaretm logaretm added the 🔼 v4.0 Will be handled in the next major version label Sep 10, 2020
@logaretm
Copy link
Owner

logaretm commented Sep 10, 2020

The first line of the docs says:

This guide is only concerned with generating error messages for globally defined validators

Your rule isn't globally defined, it's a local function. That means that error generation should be done on your part.

Not sure if this is expected or not, but I will consider invoking the global message handler if the function didn't return a string.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔼 v4.0 Will be handled in the next major version
Projects
None yet
Development

No branches or pull requests

2 participants