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) ->
if field.$valid
toggleClass(field, addClass: false)
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"
# error state whenever the $viewValue changes.
......@@ -33,7 +33,7 @@ formValidate = ['$timeout', ($timeout) ->
# Validate field when the content changes.
elem.on 'change', ':input', ->
forEachField (field) -> updateField(field) if field.$dirty
forEachField(updateField)
# Validate form on submit and set flag for error watcher.
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