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

Set form validity when element is removed from a possibly invalid ele… #245

Merged
merged 3 commits into from Dec 7, 2016

Conversation

susanolinger
Copy link

There is an issue with the form validation that prevents a form from being submitted if an element has a violation is removed from the form. The form validity never resets. I added I check to set the validity in the unrecord method for an empty list of violations.

@@ -52,6 +52,9 @@
if(id && this.violations[id]) {
delete this.violations[id];
}
if(_.isEmpty(this.violations)) {
this.ngForm.$setValidity('av', _.isEmpty(this.violations));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you could just set it to true at this point instead of re-running the isEmpty check since it will have to truthy in order to hit this point.

@robmcguinness robmcguinness merged commit de22cf6 into master Dec 7, 2016
@robmcguinness robmcguinness deleted the bugfix/validate-form-removed-elements branch December 7, 2016 02:40
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

Successfully merging this pull request may close these issues.

None yet

4 participants