Vee-validate: Need help with a custom input

Created on 30 Mar 2017  路  2Comments  路  Source: logaretm/vee-validate

Versions:

  • VueJs: 2.2.4
  • Vee-Validate: 2.0.0-beta.25

Description:

Hi, i'am trying to disable the save button on errors, but cant figure out how to do this. I put all vee-validate attributes in custom-input to encapsulate all this stuff

Steps To Reproduce:

example: http://codepen.io/ssh/pen/aJRZog

Most helpful comment

The issue is that your errors are now scoped inside your custom-input component, which is not detectable by the errors.any() method, so you should either move the validations up the chain so it is visible by the component that contains the button or use Vue events to move errors around components like this example:

http://vee-validate.logaretm.com/examples#event-bus-example

I'm considering a centralized error object since a lot of issues came up regarding this.

All 2 comments

The issue is that your errors are now scoped inside your custom-input component, which is not detectable by the errors.any() method, so you should either move the validations up the chain so it is visible by the component that contains the button or use Vue events to move errors around components like this example:

http://vee-validate.logaretm.com/examples#event-bus-example

I'm considering a centralized error object since a lot of issues came up regarding this.

Thank you for quick response! You doing a great job!

Was this page helpful?
0 / 5 - 0 ratings