Skip to content
This repository has been archived by the owner on Jul 1, 2020. It is now read-only.

Matching validation issues #68

Closed
aaronbc opened this issue Sep 10, 2015 · 2 comments
Closed

Matching validation issues #68

aaronbc opened this issue Sep 10, 2015 · 2 comments

Comments

@aaronbc
Copy link

aaronbc commented Sep 10, 2015

I created the following issues using the live demo:

Issue 1:

  1. Enter a password into the password field.
  2. Enter an identical password into the confirmation field.
  3. Before submit, go back and change the password field.
  4. Passwords validate even though they do not match anymore.

Issue 2:

  1. Remove the 'required' validation condition of the password and confirmation inputs.
  2. Enter a password into the password field.
  3. Passwords validate even though the confirmation is blank.
@ghiscoding
Copy link
Owner

Yes I can see the behavior since only changing the value on the confirmation input will trigger a validation action, basically there is no watch on the parent input (which is why the input stays valid after changing your password). I'm not crazy on having Angular-Validation to add multiple watch, but I don't think there is any other way to do it.

So I will see if I can add a $watch on the parent input (like the password field for example). That would probably fix both your issues when it becomes available.

ghiscoding added a commit that referenced this issue Sep 13, 2015
- Added a $watch on the parent so that it will invalidate confirmation
field as soon as parent is touched.
@ghiscoding
Copy link
Owner

Added a $watch on the parent field (for example Password) so that the matching input gets notified (example Password Confirmation).
Also note that it affects all matching validators, that is:

  1. match: n,
  2. different: n

Both your issues should now be fixed, if not let me know
Thanks for reporting it

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants