@@ -146,9 +146,10 @@ angular
146146 /** Check the form validity (can be called by an empty ValidationService and used by both Directive/Service)
147147 * Loop through Validation Summary and if any errors found then display them and return false on current function
148148 * @param object Angular Form or Scope Object
149+ * @param bool silently, do a form validation silently
149150 * @return bool isFormValid
150151 */
151- function checkFormValidity ( obj ) {
152+ function checkFormValidity ( obj , silently ) {
152153 var self = this ;
153154 var ctrl , elm , elmName = '' , isValid = true ;
154155 if ( typeof obj === "undefined" || typeof obj . $validationSummary === "undefined" ) {
@@ -166,10 +167,10 @@ angular
166167
167168 if ( ! ! formElmObj && ! ! formElmObj . elm && formElmObj . elm . length > 0 ) {
168169 // make the element as it was touched for CSS, only works in AngularJS 1.3+
169- if ( typeof formElmObj . ctrl . $setTouched === "function" ) {
170+ if ( typeof formElmObj . ctrl . $setTouched === "function" && ! silently ) {
170171 formElmObj . ctrl . $setTouched ( ) ;
171172 }
172- self . commonObj . updateErrorMsg ( obj . $validationSummary [ i ] . message , { isSubmitted : true , isValid : formElmObj . isValid , obj : formElmObj } ) ;
173+ self . commonObj . updateErrorMsg ( obj . $validationSummary [ i ] . message , { isSubmitted : ( ! ! silently ? false : true ) , isValid : formElmObj . isValid , obj : formElmObj } ) ;
173174 }
174175 }
175176 }
0 commit comments