0

I use VeeValidate in my project with vuex. I have a problem with simple input field that is used as a setter for length of an array. Default length = 3. It looks like this:

<input v-validate="{required: true, between: [1, 50]}" type="number" name="arrayLength" v-bind:value="arrayLength" v-on:blur="onArrayLengthBlur($event)">

What I want to do is to make changes to an array on blur, but validate the field on input. Right now when I type 51 (too large value) in this field v-validate changes it to 3 (default value). What I want to achieve in this case is for v-validate to display error while user types 51 (on input), but keep the value = 51 until blur.

Is it possible with v-validate to limit it's role for displaying errors only (I.e. not setting value of field to default if input is invalid)?

picciano
  • 22,341
  • 9
  • 69
  • 82
Mariusz
  • 103
  • 1
  • 8
  • The docs seem to suggest that you can ignore blur events by adding an empty string to your config object events: ''. I haven't tested this but it my work. – iSZ Jan 09 '18 at 22:17
  • you could implement validation for this field manually fairly quickly if you need to customize the behavior of vue validate beyond it's capability – Jeff Jan 09 '18 at 22:29

0 Answers0