Skip to content

confirmed not working on initial render that have values without field interaction #2533

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

Closed
zackspear opened this issue Dec 5, 2019 · 2 comments
Labels
🐛 bug Unintended behavior

Comments

@zackspear
Copy link

Versions

  • vee-validate: 3.1.3
  • vue: 2.5.22

Describe the bug
ValidationProvider components that use the confirmed rule will not pass validation on initial render if there's already a value associated with the component and the component that needs to match.

On initial render even if the values match you must interact with the ValidationProvider that has the confirmed rule on it for the form to become valid. It happens even if you include immediate on the ValidationProvider component(s).

To reproduce

  1. Visit one of the CodeSandbox links below
  2. Notice the existing values for both fields.
  3. Start by focusing and then blurring the first field in either example. The form will then become "valid".

Expected behavior
The form should be valid if the field values match.

Demo link
CodeSandbox put together from scratch
https://codesandbox.io/s/veevalidate-email-confirmation-with-prefilled-value-m7cq7

CodeSandbox for the Cross Field Validation example that's been slightly tweaked to include "existing" values
https://codesandbox.io/s/codesandbox-zbpjy

Additional context
Currently using localStorage on a production site to pre-fill email and email confirmation fields for a checkout form to help repeat customers quickly move through the checkout flow. Which prompted us to see this issue as it was raised by a user.

@logaretm logaretm added the 🐛 bug Unintended behavior label Dec 5, 2019
@logaretm
Copy link
Owner

logaretm commented Dec 5, 2019

Thanks for reporting this, I have identified the issue and a fix should be available in the next release.

@zackspear
Copy link
Author

zackspear commented Dec 5, 2019 via email

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