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

Checkbox validation gets called twice #4702

Closed
2 of 5 tasks
holygekko opened this issue Mar 15, 2024 · 1 comment
Closed
2 of 5 tasks

Checkbox validation gets called twice #4702

holygekko opened this issue Mar 15, 2024 · 1 comment

Comments

@holygekko
Copy link

What happened?

When you have a field of type checkbox the validation rule(s) get called twice instead of once (like with a text input)

Reproduction steps

  1. open the example on the homepage in stackblitz
  2. in the schema definition remove the yup.object and make it a regular object
  3. create your custom rule function. can be anything, but include a console.log
  4. change the field type to checkbox
  5. open the console, run the example and see your log statement printed twice when you click the checkbox (the non checkbox field doesn't do this)

Version

Vue.js 3.x and vee-validate 4.x

What browsers are you seeing the problem on?

  • Firefox
  • Chrome
  • Safari
  • Microsoft Edge

Relevant log output

No response

Demo link

https://vee-validate.logaretm.com/v4/

Code of Conduct

@logaretm
Copy link
Owner

This is expected, because clicking a checkbox emits both a change and input events. vee-validate validates on both either way to sync the value and the .valid flag regardless of user config. I did consider excluding the input event validation but user may have configured it to validate then, so we would be forced to listen regardless.

Text boxes does follow the same behavior if you type something then leave the input, that would emit input then change respectively.

This may get partially solved with #4630

@logaretm logaretm closed this as not planned Won't fix, can't repro, duplicate, stale May 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants