@@ -52,16 +52,17 @@ sfPath, sfSelect) {
52
52
} else if ( angular . isString ( form . onClick ) ) {
53
53
if ( sfSchema ) {
54
54
//evaluating in scope outside of sfSchemas isolated scope
55
- sfSchema . evalInParentScope ( form . onClick , { '$event' : $event , form : form } ) ;
55
+ sfSchema . evalInParentScope ( form . onClick , { '$event' : $event , form : form } ) ;
56
56
} else {
57
- scope . $eval ( form . onClick , { '$event' : $event , form : form } ) ;
57
+ scope . $eval ( form . onClick , { '$event' : $event , form : form } ) ;
58
58
}
59
59
}
60
60
} ;
61
61
62
62
/**
63
63
* Evaluate an expression, i.e. scope.$eval
64
64
* but do it in sfSchemas parent scope sf-schema directive is used
65
+ *
65
66
* @param {string } expression
66
67
* @param {Object } locals (optional)
67
68
* @return {Any } the result of the expression
@@ -160,16 +161,25 @@ sfPath, sfSelect) {
160
161
// It looks better with dot notation.
161
162
scope . $on (
162
163
'schemaForm.error.' + form . key . join ( '.' ) ,
163
- function ( event , error , validationMessage , validity ) {
164
+ function ( event , error , validationMessage , validity , formName ) {
165
+ // validationMessage and validity are mutually exclusive
166
+ formName = validity ;
164
167
if ( validationMessage === true || validationMessage === false ) {
165
168
validity = validationMessage ;
166
169
validationMessage = undefined ;
167
- }
170
+ } ;
171
+
172
+ // If we have specified a form name, and this model is not within
173
+ // that form, then leave things be.
174
+ if ( formName != undefined && scope . ngModel . $$parentForm . $name !== formName ) {
175
+ return ;
176
+ } ;
168
177
169
178
if ( scope . ngModel && error ) {
170
179
if ( scope . ngModel . $setDirty ) {
171
180
scope . ngModel . $setDirty ( ) ;
172
- } else {
181
+ }
182
+ else {
173
183
// FIXME: Check that this actually works on 1.2
174
184
scope . ngModel . $dirty = true ;
175
185
scope . ngModel . $pristine = false ;
0 commit comments