Skip to content

Commit 217188c

Browse files
committed
Migrate PR #589 to webpack branch
1 parent 7bec853 commit 217188c

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/directives/schemaValidate.js

+9-2
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,12 @@ export default function(sfValidator, $parse, sfSelect) {
107107
var schema = form.schema;
108108

109109
// A bit ugly but useful.
110-
scope.validateField = function() {
110+
scope.validateField = function(formName) {
111+
// If we have specified a form name, and this model is not within
112+
// that form, then leave things be.
113+
if (formName != undefined && ngModel.$$parentForm.$name !== formName) {
114+
return;
115+
}
111116

112117
// Special case: arrays
113118
// TODO: Can this be generalized in a way that works consistently?
@@ -162,7 +167,9 @@ export default function(sfValidator, $parse, sfSelect) {
162167
});
163168

164169
// Listen to an event so we can validate the input on request
165-
scope.$on('schemaFormValidate', scope.validateField);
170+
scope.$on('schemaFormValidate', function(event, formName) {
171+
scope.validateField(formName);
172+
});
166173

167174
scope.schemaError = function() {
168175
return error;

0 commit comments

Comments
 (0)