From 33438a597f6fd807d2783974dbca486e7604684b Mon Sep 17 00:00:00 2001 From: "Ghislain B." Date: Sun, 16 Feb 2014 12:23:13 -0500 Subject: [PATCH] always run validation when field is not empty --- angular-validation.js | 3 ++- index.html | 1 - templates/testingForm.html | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/angular-validation.js b/angular-validation.js index 7de2880..9ac9653 100644 --- a/angular-validation.js +++ b/angular-validation.js @@ -351,6 +351,7 @@ if(elmTagName === "SELECT") { if(isFieldRequired && (value === "" || typeof value === "undefined")) { // if select option is null or empty string we already know it's invalid + // but we'll still run validation() to display proper error message ctrl.$setValidity('validation', validate(value)); elm.unbind('blur'); return value; @@ -364,7 +365,7 @@ // in case the field is already pre-filled // we need to validate it without looking at the event binding - if(ctrl.$pristine && value !== "" && typeof value !== "undefined") { + if(value !== "" && typeof value !== "undefined") { var isValid = validate(value); ctrl.$setValidity('validation', isValid); } diff --git a/index.html b/index.html index 714146b..1178743 100644 --- a/index.html +++ b/index.html @@ -26,7 +26,6 @@

{{'CHANGE_LANGUAGE' | translate}}

- diff --git a/templates/testingForm.html b/templates/testingForm.html index e6fffaf..36c479a 100644 --- a/templates/testingForm.html +++ b/templates/testingForm.html @@ -4,7 +4,7 @@
- +