Search code examples
vee-validate

vee: validate with required fails when setting checkbox value programmatically


This: https://codesandbox.io/s/jovial-glade-tg7ev

ValidationObserver works when clicking a, b or c checkbox. But when value is inserted in array programmatically (click button), the ValidattionObserver doesn't detect it. Is that an error and I think the valid property from ValidationObserver should change?

Ken


Solution

  • To test the validation when setting the values programatically, you have to call the following piece of code, just after you've updated the value, and put a ref="observer" on the ValidationObserver component.

    this.$refs.observer.validate();
    

    Updated codesandbox: https://codesandbox.io/s/summer-pine-mrrlm