ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anovi...@apache.org
Subject [47/50] [abbrv] ignite git commit: IGNITE-843 Fixed validation in case of empty required input.
Date Mon, 28 Mar 2016 08:48:27 GMT
IGNITE-843 Fixed validation in case of empty required input.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/cadbc5f8
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/cadbc5f8
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/cadbc5f8

Branch: refs/heads/ignite-2875
Commit: cadbc5f87992209c59e1ca883cbe5f91a6a99a11
Parents: 630cbbe
Author: AKuznetsov <akuznetsov@gridgain.com>
Authored: Fri Mar 25 22:59:15 2016 +0700
Committer: AKuznetsov <akuznetsov@gridgain.com>
Committed: Fri Mar 25 22:59:15 2016 +0700

----------------------------------------------------------------------
 .../form-field-java-class.directive.js                    | 10 ++++++----
 .../js/app/modules/form/field/input/text.directive.js     | 10 ++++++----
 2 files changed, 12 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/cadbc5f8/modules/control-center-web/src/main/js/app/directives/form-field-java-class/form-field-java-class.directive.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/app/directives/form-field-java-class/form-field-java-class.directive.js
b/modules/control-center-web/src/main/js/app/directives/form-field-java-class/form-field-java-class.directive.js
index 142cb25..43219f9 100644
--- a/modules/control-center-web/src/main/js/app/directives/form-field-java-class/form-field-java-class.directive.js
+++ b/modules/control-center-web/src/main/js/app/directives/form-field-java-class/form-field-java-class.directive.js
@@ -56,10 +56,12 @@ export default ['igniteFormFieldJavaClass', ['IgniteFormGUID', (guid)
=> {
         scope.$watch('value', setAsDefault);
 
         const checkValid = () => {
-            if (ngModel.$invalid)
-                el.find('input').removeClass('ng-valid').addClass('ng-invalid');
-            else
-                el.find('input').addClass('ng-valid').removeClass('ng-invalid');
+            const input = el.find('input');
+
+            const invalid = ngModel.$invalid || (input[0].required && !input[0].value);
+
+            input.removeClass(invalid ? 'ng-valid' : 'ng-invalid');
+            input.addClass(invalid ? 'ng-invalid' : 'ng-valid');
         };
 
         scope.ngChange = () => {

http://git-wip-us.apache.org/repos/asf/ignite/blob/cadbc5f8/modules/control-center-web/src/main/js/app/modules/form/field/input/text.directive.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/app/modules/form/field/input/text.directive.js
b/modules/control-center-web/src/main/js/app/modules/form/field/input/text.directive.js
index 99d7525..21b0d0f 100644
--- a/modules/control-center-web/src/main/js/app/modules/form/field/input/text.directive.js
+++ b/modules/control-center-web/src/main/js/app/modules/form/field/input/text.directive.js
@@ -64,10 +64,12 @@ export default ['igniteFormFieldInputText', ['IgniteFormGUID', (guid)
=> {
         scope.$watch('value', setAsDefault);
 
         const checkValid = () => {
-            if (ngModel.$invalid)
-                el.find('input').removeClass('ng-valid').addClass('ng-invalid');
-            else
-                el.find('input').addClass('ng-valid').removeClass('ng-invalid');
+            const input = el.find('input');
+
+            const invalid = ngModel.$invalid || (input[0].required && !input[0].value);
+
+            input.removeClass(invalid ? 'ng-valid' : 'ng-invalid');
+            input.addClass(invalid ? 'ng-invalid' : 'ng-valid');
         };
 
         scope.ngChange = () => {


Mime
View raw message