question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ValidationProvider for nested components

See original GitHub issue

Hi I have a component, named CustomInput, which is kind of a big switch case by types, and accordingly renders the relevant field.

I want to wrap it with ValidationProvider. The problem is that the ValidationProvider works only if the rendered input is a direct child and not a nested one.

Working scenario: ValidationProvider rules=“required” -> template slot-scope -> input[type=text]

Not working: ValidationProvider rules=“required” -> template slot-scope -> CustomInputText -> input[type=text]

Any idea why it happens?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
Drenskincommented, Jun 5, 2020

Hello,

I’ve forked and updated your code to demonstrate the issue : https://codesandbox.io/s/vue-template-xw2sl

I have just added <template v-slot:default="slotProps"> around the input to demonstrate that Vee-Validate fails to find the input to validate.

I have the same issue with VeeValidate 3.3.2.

Could you have a look please ?

1reaction
logaretmcommented, Mar 28, 2019

I can’t help you much without a working sample, but I have a few guesses:

  • Your CustomInput does not use v-model which is a requirement, otherwise, you need to work with the Provider API manually.
  • Your CustomInput does not emit any events like input.
Read more comments on GitHub >

github_iconTop Results From Across the Web

ValidationProvider for nested components #1971 - GitHub
Hi I have a component, named CustomInput, which is kind of a big switch case by types, and accordingly renders the relevant field....
Read more >
Validation Provider - VeeValidate
The ValidationProvider component is a regular component that wraps your inputs and ... meaning nested inputs inside other components will not be detected....
Read more >
Observe deep nested child components with Vee-Validate v4 ...
Validation rules could be declared at the child component level. Is there a way to achieve the same in Vue3 / Vee-Validate 4?...
Read more >
Vee-Validate.ValidationProvider bug with nested inputs
ValidationProvider bug with nested inputs ... Forked FromValidation Components - BootstrapVue; Environmentvue-cli. Files. src. App.vue. Input.vue. main.js.
Read more >
Persisting Validation State and Nesting ValidationObservers ...
We can persist validation state with the keep-alive component. ... import { ValidationProvider, ValidationObserver, extend } from ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found