kazupon / vue-validator

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

Cannot clear rules dynamically #330

Open dragantl opened 7 years ago

dragantl commented 7 years ago

vue & vue-validator version

1.0.28, 2.1.6

Reproduction Link

https://jsfiddle.net/ek3nffcd/5/

Steps to reproduce

  1. Enter text into bar to remove it as an error factor (added 2nd filed to have at least one validation present)
  2. Note that foo is not required when run initially
  3. Check the checkbox
  4. foo is now required
  5. Un-check the checkbox
  6. Foo is still required
  7. Enter text into foo
  8. Check the checkbox
  9. Remove text from foo
  10. Un-check the checkbox

    What is Expected?

After step 4, I expect form to become valid because foo is no longer required After step 6, I would expect some change... seems validation doesn't occur at all After step 9, I again expect the form to be valid

What is actually happening?

It seems that the removal of validation does nothing. In my project, I want to toggle a checkbox that would add/remove validation from certail fieldset while making that fieldset disabled (not hiding it). However, when fields are enabled, there is no way to remove their validation requirement afterwards.