Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic validation rules fail when using both regex and required true #710

Closed
sembogaarts opened this issue Aug 8, 2017 · 0 comments
Closed
Labels
🐛 bug Unintended behavior

Comments

@sembogaarts
Copy link

sembogaarts commented Aug 8, 2017

Versions:

  • VueJs: 2.3.3
  • Vee-Validate: 2.0.0-rc.8

Description:

When switching between dynamic (computed) validation rules, containing a regex and required true:

{
    rules: {
        required: true, 
        regex: /^([0-9]{4})$/
    }
}

switching to:

{
    rules: {
        required: true, 
        regex: /^([a-z]{5})$/
    }
}

The validator does not update the regex validation. After some testing it appears that when both validation rules contain "required: true", the regex will not update when the rule is changed.

Steps To Reproduce:

Working situation (If one rule is not required):
https://jsfiddle.net/gcnf5ucn/12/

NOT working situation (both rules required):
https://jsfiddle.net/gcnf5ucn/11/

Workaround:

When you change the order of the rules object, it seems to work.
Working demo: https://jsfiddle.net/gcnf5ucn/13/

@logaretm logaretm added the 🐛 bug Unintended behavior label Aug 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Unintended behavior
Projects
None yet
Development

No branches or pull requests

2 participants