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

Names with multiple dots are matched against fields correctly #856

Closed
yusupprog opened this issue Sep 27, 2017 · 1 comment
Closed

Names with multiple dots are matched against fields correctly #856

yusupprog opened this issue Sep 27, 2017 · 1 comment
Labels
✨ enhancement a "nice to have" feature

Comments

@yusupprog
Copy link

yusupprog commented Sep 27, 2017

Hi. Great plugin. Use it in almost every project.

Versions:

  • VueJs: 2.4.4
  • Vee-Validate: 2.0.0-rc.17

Description:

{
  "items": [
    {
      "id": "_rbtixeai4",
      "field": "translations.ru.name",
      "msg": "The translations.ru.name field is required.",
      "rule": "required",
      "scope": "create-wheat-characteristic-categories"
    },
    {
      "id": "_epmme5y0o",
      "field": "translations.kk.name",
      "msg": "The translations.kk.name field is required.",
      "rule": "required",
      "scope": "create-wheat-characteristic-categories"
    }
  ]
}

but errors.has('create-wheat-characteristic-categories.translations.ru.name') returns false

this works errors.has('translations.ru.name', 'create-wheat-characteristic-categories')

By the way how can I make this laravel validation https://laravel.com/docs/5.5/validation#rule-required-without-all

Steps To Reproduce:

@yusupprog yusupprog changed the title Hi Don't see dot delimited errors Sep 27, 2017
@yusupprog yusupprog changed the title Don't see dot delimited errors Doesn't see dot delimited errors Sep 27, 2017
@logaretm logaretm added the ✨ enhancement a "nice to have" feature label Sep 27, 2017
@logaretm
Copy link
Owner

Multiple dots seem to confuse the validator, we will fix this by making it only split on the first dot.

As for your inquiry, The directive accepts an expression which is normally a string as you are used to. but it can be also a conditional expression.

take a look at this example:

https://jsfiddle.net/logaretm/p0766ckj/

The email field is only required if the name is not empty, so you can build your own expression with any condition you need, that is why required_if and such rules are not implemented.

@logaretm logaretm changed the title Doesn't see dot delimited errors Names with multiple dots are matched against fields correctly Sep 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ enhancement a "nice to have" feature
Projects
None yet
Development

No branches or pull requests

2 participants