kazupon / vue-validator

:white_check_mark: Validator component for Vue.js
MIT License
2.19k stars 431 forks source link

Disable part of validation #64

Closed trippo80 closed 9 years ago

trippo80 commented 9 years ago

Hi,

Thanks again for this awesome component!

I have a question/request. I have this form that consists of two separate steps. It's basically two divs where one of them is visible and the other is hidden (with display: none). When the user is finished with step 1 and clicks the button "Next step" the div for first step 1 slides away and div for step 2 slides in and is visible.

The issue is that I have validation on both steps and I prevent the user from clicking "Next step" on step 1 until all fields are valid by using ' v-attr="disabled: !valid"'. The form will never be valid because step 2 isn't valid.

Do I need to separate this into two separate components or for example use wait-for on all step 2 fields - or is there a better solution?

Can I disable some of the validation in the component?

trippo80 commented 9 years ago

Nevermind this issue - I was trying to solve this the wrong way. The solution in my case is of course to have separate components per step. Makes sense.