Commit f97152ec authored by Aron Carroll's avatar Aron Carroll Committed by Randall Leeds

Only apply error class to form if fields are dirty

parent 7e708fdd
...@@ -15,7 +15,7 @@ formValidate = ['$timeout', ($timeout) -> ...@@ -15,7 +15,7 @@ formValidate = ['$timeout', ($timeout) ->
if field.$valid if field.$valid
toggleClass(field, addClass: false) toggleClass(field, addClass: false)
else else
toggleClass(field, addClass: true) toggleClass(field, addClass: true) if field.$dirty
# A custom parser for each form field that is used to reset the "response" # A custom parser for each form field that is used to reset the "response"
# error state whenever the $viewValue changes. # error state whenever the $viewValue changes.
...@@ -33,7 +33,7 @@ formValidate = ['$timeout', ($timeout) -> ...@@ -33,7 +33,7 @@ formValidate = ['$timeout', ($timeout) ->
# Validate field when the content changes. # Validate field when the content changes.
elem.on 'change', ':input', -> elem.on 'change', ':input', ->
forEachField (field) -> updateField(field) if field.$dirty forEachField(updateField)
# Validate form on submit and set flag for error watcher. # Validate form on submit and set flag for error watcher.
elem.on 'submit', -> elem.on 'submit', ->
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment