Skip to content

Commit 161e0ec

Browse files
committed
feat(form) Revert - If css style is BS3 then has-error is now applied to form-group
1 parent 8d32462 commit 161e0ec

File tree

1 file changed

+1
-23
lines changed

1 file changed

+1
-23
lines changed

js/directives/form.js

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -523,8 +523,7 @@ formsAngular
523523
element.replaceWith($compile(elementHtml)(scope));
524524
// If there are subkeys we need to fix up ng-model references when record is read
525525
// If we have modelControllers we need to let them know when we have form + data
526-
// If BS3 we need to set up validation styling watch
527-
if (subkeys.length > 0 || $data.modelControllers.length > 0 || cssFrameworkService.framework() === 'bs3') {
526+
if (subkeys.length > 0 || $data.modelControllers.length > 0) {
528527
var unwatch2 = scope.$watch('phase', function (newValue) {
529528
if (newValue === 'ready') {
530529
unwatch2();
@@ -590,27 +589,6 @@ formsAngular
590589
scope['$_arrayOffset_' + info.name.replace(/\./g, '_') + '_' + thisOffset] = arrayOffset;
591590
}
592591
}
593-
594-
// If BS3, set up a watch on the record, so we can set has-error class etc
595-
if (cssFrameworkService.framework() === 'bs3') {
596-
597-
// create the function that will do the checking / updating
598-
scope.bs3ValidationStyling = function() {
599-
angular.forEach(scope[scope.topLevelFormName], function (value, key) {
600-
if (typeof value === 'object' && value.hasOwnProperty('$modelValue')) {
601-
var element = angular.element('#cg_' + key);
602-
if (value.$valid) {
603-
element.removeClass('has-error');
604-
} else {
605-
element.addClass('has-error');
606-
}
607-
}
608-
});
609-
};
610-
611-
scope.$watch(recordAttribute, scope.bs3ValidationStyling, true);
612-
scope.bs3ValidationStyling(); // Initialise the styling
613-
}
614592
}
615593
});
616594
}

0 commit comments

Comments
 (0)