Skip to content
This repository has been archived by the owner on Jul 1, 2020. It is now read-only.

Commit

Permalink
Sanitized messages & fixed issue #69
Browse files Browse the repository at this point in the history
- Added sanitize to the demo page
- Fixed issue #69, display proper error message when user type invalid
chars on an input[number]
  • Loading branch information
ghiscoding committed Oct 13, 2015
1 parent 2d9ba48 commit 1b74d9e
Show file tree
Hide file tree
Showing 29 changed files with 566 additions and 181 deletions.
3 changes: 2 additions & 1 deletion app.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

var myApp = angular.module('myApp', ['ngRoute', 'ghiscoding.validation', 'pascalprecht.translate']);
var myApp = angular.module('myApp', ['ngRoute', 'ngSanitize', 'ghiscoding.validation', 'pascalprecht.translate']);

myApp.config(['$compileProvider', '$locationProvider', '$routeProvider', function ($compileProvider, $locationProvider, $routeProvider) {
$compileProvider.debugInfoEnabled(false);
Expand All @@ -19,6 +19,7 @@ myApp.config(['$compileProvider', '$locationProvider', '$routeProvider', functio

// load English ('en') table on startup
$translateProvider.preferredLanguage('en');
$translateProvider.useSanitizeValueStrategy('escapeParameters');
}]);

// -- Main page Controller
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-validation-ghiscoding",
"version": "1.4.9",
"version": "1.4.10",
"author": "Ghislain B.",
"description": "Angular-Validation Directive and Service (ghiscoding)",
"main": [
Expand Down
2 changes: 2 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
Angular-Validation change logs

1.4.10 (2015-10-12) Sanitized error messages. Fixed issue #69 - Stop when invalid characters typed on input[number].
1.4.9 (2015-10-05) Enhancement #57, #66, #67 - Added 3rd party addon validation (like ngTagsInput, Angular Multiselect, Dropdown multi-select, etc...)
1.4.8 (2015-09-12) Fixed issue #68 - Matching validation issue (password confirmation).
1.4.7 (2015-09-08) Fixed issue #65 - invalid return value on function String.format()
1.4.6 (2015-09-04) Accepted pull #64 - Update Spanish `es.json` translation file.
Expand Down
10 changes: 5 additions & 5 deletions dist/angular-validation.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions full-tests/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ <h1>Angular-Validation Directive|Service (ghiscoding)</h1>
<ng-view></ng-view>

<!-- external librairies CDN -->
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.4/angular.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.4/angular-route.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular-route.js"></script>

<!-- angular-translate -->
<!-- Visit Angular-Translate https://github.com/PascalPrecht/angular-translate -->
Expand Down
5 changes: 3 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ <h1>Angular-Validation Directive|Service (ghiscoding)</h1>
<ng-view></ng-view>

<!-- external librairies CDN -->
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.4/angular.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.4/angular-route.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular-route.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular-sanitize.js"></script>

<!-- angular-translate -->
<!-- Visit Angular-Translate https://github.com/PascalPrecht/angular-translate -->
Expand Down
14 changes: 7 additions & 7 deletions locales/validation/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@
"INVALID_FLOAT_SIGNED": "May only contain a positive or negative float value (integer excluded). ",
"INVALID_IBAN": "Must be a valid IBAN. ",
"INVALID_IN_LIST": "Must be a choice inside this list: ({0}). ",
"INVALID_INPUT_DIFFERENT": "Field must be different from specified field \"{1}\". ",
"INVALID_INPUT_MATCH": "Confirmation field does not match specified field \"{1}\". ",
"INVALID_INPUT_DIFFERENT": "Field must be different from specified field [{1}]. ",
"INVALID_INPUT_MATCH": "Confirmation field does not match specified field [{1}]. ",
"INVALID_INTEGER": "Must be a positive integer. ",
"INVALID_INTEGER_SIGNED": "Must be a positive or negative integer. ",
"INVALID_IPV4": "Must be a valid IP (IPV4). ",
"INVALID_IPV6": "Must be a valid IP (IPV6). ",
"INVALID_IPV6_HEX": "Must be a valid IP (IPV6 Hex). ",
"INVALID_KEY_CHAR": "Invalid keyboard entry on a field of type \"number\". ",
"INVALID_KEY_CHAR": "Invalid keyboard entry on a field of type 'number'. ",
"INVALID_MAX_CHAR": "May not be greater than {0} characters. ",
"INVALID_MAX_NUM": "Needs to be a numeric value, equal to, or lower than {0}. ",
"INVALID_MIN_CHAR": "Must be at least {0} characters. ",
Expand All @@ -55,7 +55,7 @@
"INVALID_NUMERIC": "Must be a positive number. ",
"INVALID_NUMERIC_SIGNED": "Must be a positive or negative number. ",
"INVALID_PATTERN": "Must be following this format: {0}. ",
"INVALID_PATTERN_DATA": "Must be following this format \"{{data}}\". ",
"INVALID_PATTERN_DATA": "Must be following this format {{data}}. ",
"INVALID_REQUIRED": "Field is required. ",
"INVALID_URL": "Must be a valid URL. ",
"INVALID_TIME": "Must be a valid time format (hh:mm) OR (hh:mm:ss). ",
Expand All @@ -65,8 +65,8 @@
"ERRORS": "Errors",
"CHANGE_LANGUAGE": "Change language",
"FORM_PREVALIDATED": "Form is pre-validated",
"INPUT1": "Remote validation - Type \"abc\" for a valid answer ",
"INPUT2": "Number positive or negative -- input type=\"number\" -- Error on non-numeric characters ",
"INPUT1": "Remote validation - Type 'abc' for a valid answer ",
"INPUT2": "Number positive or negative -- input type='number' -- Error on non-numeric characters ",
"INPUT3": "Floating number range (integer excluded) -- between_num:x,y OR min_num:x|max_num:y ",
"INPUT4": "Multiple Validations + Custom Regex of Date Code (YYWW)",
"INPUT5": "Email",
Expand All @@ -77,7 +77,7 @@
"INPUT10": "Date ISO (yyyy-mm-dd)",
"INPUT11": "Date US LONG (mm/dd/yyyy)",
"INPUT12": "Time (hh:mm OR hh:mm:ss) -- NOT Required",
"INPUT13": "AlphaDashSpaces + Required + Minimum(5) Characters -- MUST USE: validation-error-to=\" \"",
"INPUT13": "AlphaDashSpaces + Required + Minimum(5) Characters -- MUST USE: validation-error-to=' '",
"INPUT14": "Alphanumeric + Required -- NG-DISABLED",
"INPUT15": "Password",
"INPUT16": "Password Confirmation",
Expand Down
13 changes: 7 additions & 6 deletions locales/validation/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@
"INVALID_FLOAT_SIGNED": "Debe contener un número decimal positivo ó negativo (Los números enteros no son válidos). ",
"INVALID_IBAN": "Debe contener un IBAN válido. ",
"INVALID_IN_LIST": "Debe ser una opción dentro de esta lista: ({0}). ",
"INVALID_INPUT_DIFFERENT": "El campo debe ser diferente del campo \"{1}\" especificado. ",
"INVALID_INPUT_MATCH": "El campo de confirmación no coincide con el texto especificado en \"{1}\". ",
"INVALID_INPUT_DIFFERENT": "El campo debe ser diferente del campo [{1}] especificado. ",
"INVALID_INPUT_MATCH": "El campo de confirmación no coincide con el texto especificado en [{1}]. ",
"INVALID_INTEGER": "Debe contener un número entero positivo. ",
"INVALID_INTEGER_SIGNED": "Debe contener un número entero positivo ó negativo. ",
"INVALID_IPV4": "Debe contener una dirección IP válida (IPV4). ",
"INVALID_IPV6": "Debe contener una dirección IP válida (IPV6). ",
"INVALID_IPV6_HEX": "Debe contener una dirección IP válida (IPV6 Hex). ",
"INVALID_KEY_CHAR": "Entrada de teclado no válida en un campo de tipo \"number\". ",
"INVALID_KEY_CHAR": "Entrada de teclado no válida en un campo de tipo 'number'. ",
"INVALID_MAX_CHAR": "No puede contener más de {0} caracteres. ",
"INVALID_MAX_NUM": "Debe contener un valor númerico igual o menor que {0}. ",
"INVALID_MIN_CHAR": "Debe contener al menos {0} caracteres. ",
Expand All @@ -55,6 +55,7 @@
"INVALID_NUMERIC": "Debe contener un valor númerico positivo. ",
"INVALID_NUMERIC_SIGNED": "Debe contener un valor númerico positivo ó negativo. ",
"INVALID_PATTERN": "Debe contener un texto con el formato: {0}. ",
"INVALID_PATTERN_DATA": "Debe contener un texto con el formato {{data}}. ",
"INVALID_REQUIRED": "Campo requerido. ",
"INVALID_URL": "Debe contener una dirección URL válida. ",
"INVALID_TIME": "Debe contener un formato de tiempo válido (hh:mm) ó (hh:mm:ss). ",
Expand All @@ -64,8 +65,8 @@
"ERRORS": "Errores",
"CHANGE_LANGUAGE": "Cambiar idioma",
"FORM_PREVALIDATED": "El formulario es pre-validado",
"INPUT1": "Validación Remota - Escriba \"abc\" para una respuesta válida ",
"INPUT2": "Número positivo o negativo -- input type=\"number\" -- Error o caracteres no númericos ",
"INPUT1": "Validación Remota - Escriba 'abc' para una respuesta válida ",
"INPUT2": "Número positivo o negativo -- input type='number' -- Error o caracteres no númericos ",
"INPUT3": "Rango decimal (Los números enteros no son válidos) -- between_num:x,y ó min_num:x|max_num:y ",
"INPUT4": "Multiples validaciones + Código de fecha personalizado (YYWW)",
"INPUT5": "Email",
Expand All @@ -76,7 +77,7 @@
"INPUT10": "Fecha formato ISO (yyyy-mm-dd)",
"INPUT11": "Fecha formato US largo (mm/dd/yyyy)",
"INPUT12": "Tiempo (hh:mm ó hh:mm:ss) -- No Requerido",
"INPUT13": "AlphaDashSpaces + Requerido + Mínimo(5) Caracteres -- Deben ser: validation-error-to=\" \"",
"INPUT13": "AlphaDashSpaces + Requerido + Mínimo(5) Caracteres -- Deben ser: validation-error-to=' '",
"INPUT14": "Alfanúmerico + Requerido -- NG-DISABLED",
"INPUT15": "Contraseña",
"INPUT16": "Confirmación de Contraseña",
Expand Down
14 changes: 7 additions & 7 deletions locales/validation/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@
"INVALID_FLOAT_SIGNED": "Doit être obligatoirement un nombre flottant positif ou négatif (nombre entier exclu). ",
"INVALID_IBAN": "Doit être un IBAN valide. ",
"INVALID_IN_LIST": "Doit être un choix dans cette liste: ({0}). ",
"INVALID_INPUT_DIFFERENT": "Le champ doit être différente du champ spécifié \"{1}\". ",
"INVALID_INPUT_MATCH": "Le champ de confirmation ne correspond pas au champs spécifié \"{1}\". ",
"INVALID_INPUT_DIFFERENT": "Le champ doit être différente du champ spécifié [{1}]. ",
"INVALID_INPUT_MATCH": "Le champ de confirmation ne correspond pas au champs spécifié [{1}]. ",
"INVALID_INTEGER": "Doit être un nombre entier positif. ",
"INVALID_INTEGER_SIGNED": "Doit être un nombre entier positif ou négatif. ",
"INVALID_IPV4": "Doit être un IP valide (IPV4). ",
"INVALID_IPV6": "Doit être un IP valide (IPV6). ",
"INVALID_IPV6_HEX": "Doit être un IP valide (IPV6 Hex). ",
"INVALID_KEY_CHAR": "Entrée clavier invalide sur un champs de type \"nombre\". ",
"INVALID_KEY_CHAR": "Entrée clavier invalide sur un champs de type 'nombre'. ",
"INVALID_MAX_CHAR": "Doit être plus petit que {0} caractères. ",
"INVALID_MAX_NUM": "Doit être une valeur numérique, égale ou inférieure à {0}. ",
"INVALID_MIN_CHAR": "Doit avoir au moins {0} caractères. ",
Expand All @@ -55,7 +55,7 @@
"INVALID_NUMERIC": "Doit être un nombre positif. ",
"INVALID_NUMERIC_SIGNED": "Doit être un nombre positif ou négatif. ",
"INVALID_PATTERN": "Doit suivre le format: {0}. ",
"INVALID_PATTERN_DATA": "Doit suivre le format \"{{data}}\". ",
"INVALID_PATTERN_DATA": "Doit suivre le format {{data}}. ",
"INVALID_REQUIRED": "Le champ est requis. ",
"INVALID_URL": "Doit être un URL valide. ",
"INVALID_TIME": "Doit être un format de temps valide (hh:mm) OU (hh:mm:ss). ",
Expand All @@ -65,8 +65,8 @@
"ERRORS": "Erreurs",
"CHANGE_LANGUAGE": "Changer de langue",
"FORM_PREVALIDATED": "Formulaire est pré-validé",
"INPUT1": "Validation à Distance - Taper \"abc\" pour une réponse valide ",
"INPUT2": "Nombre positif ou négatif -- input type=\"number\" -- Erreur sur caractères non-numérique",
"INPUT1": "Validation à Distance - Taper 'abc' pour une réponse valide ",
"INPUT2": "Nombre positif ou négatif -- input type='number' -- Erreur sur caractères non-numérique",
"INPUT3": "Intervalle de Nombre Flottant (entier exclu) -- between_num:x,y OU min_num:x|max_num:y",
"INPUT4": "Multiple Validations + Regex Personnalisé d'un Code Date (AASS)",
"INPUT5": "Courriel",
Expand All @@ -77,7 +77,7 @@
"INPUT10": "Date ISO (aaaa-mm-jj)",
"INPUT11": "Date US LONG (mm/jj/aaaa)",
"INPUT12": "Time (hh:mm OU hh:mm:ss) -- NON Requis",
"INPUT13": "AlphaDashSpaces + Requis + Minimum(5) Caractères -- DOIT UTILISER: validation-error-to=\" \"",
"INPUT13": "AlphaDashSpaces + Requis + Minimum(5) Caractères -- DOIT UTILISER: validation-error-to=' '",
"INPUT14": "Alphanumérique + Requis -- NG-DISABLED",
"INPUT15": "Mot de Passe",
"INPUT16": "Mot de Passe (Confirmation)",
Expand Down
14 changes: 7 additions & 7 deletions locales/validation/no.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@
"INVALID_FLOAT_SIGNED": "Kan bare inneholde en positiv eller negativ flyttalsverdi (heltall ekskludert). ",
"INVALID_IBAN": "Må være en gyldig IBAN. ",
"INVALID_IN_LIST": "Må være et valg inne i denne listen: ({0}). ",
"INVALID_INPUT_DIFFERENT": "Feltet skal være forskjellig fra den angitte felt \"{1}\". ",
"INVALID_INPUT_MATCH": "Bekreftelsesfeltet er ikke likt spesifisert felt \"{1}\". ",
"INVALID_INPUT_DIFFERENT": "Feltet skal være forskjellig fra den angitte felt [{1}]. ",
"INVALID_INPUT_MATCH": "Bekreftelsesfeltet er ikke likt spesifisert felt [{1}]. ",
"INVALID_INTEGER": "Må være et positivt heltall. ",
"INVALID_INTEGER_SIGNED": "Må være et positivt eller negativt heltall. ",
"INVALID_IPV4": "Må være en gyldig IP-adresse (IPV4). ",
"INVALID_IPV6": "Må være en gyldig IP-adresse (IPV6). ",
"INVALID_IPV6_HEX": "Må være en gyldig IP-adresse (IPV6 Hex). ",
"INVALID_KEY_CHAR": "Ugyldig tastaturoppføring på felt av type \"number\". ",
"INVALID_KEY_CHAR": "Ugyldig tastaturoppføring på felt av type 'number'. ",
"INVALID_MAX_CHAR": "Kan ikke være større enn {0} characters. ",
"INVALID_MAX_NUM": "Må være en numerisk verdi, lik, eller mindre enn {0}. ",
"INVALID_MIN_CHAR": "Må være minst {0} tegn. ",
Expand All @@ -55,7 +55,7 @@
"INVALID_NUMERIC": "Må være et positivt tall. ",
"INVALID_NUMERIC_SIGNED": "Må være et positivt eller negativt tall. ",
"INVALID_PATTERN": "Må være på følgende format: {0}. ",
"INVALID_PATTERN_DATA": "Må være på følgende format \"{{data}}\". ",
"INVALID_PATTERN_DATA": "Må være på følgende format {{data}}. ",
"INVALID_REQUIRED": "Feltet er påkrevd. ",
"INVALID_URL": "Må være en gyldig URL. ",
"INVALID_TIME": "Må være et gyldig tidsformat (tt:mm) OR (tt:mm:ss). ",
Expand All @@ -65,8 +65,8 @@
"ERRORS": "Feil",
"CHANGE_LANGUAGE": "Endre språk.",
"FORM_PREVALIDATED": "Form er pre-godkjent",
"INPUT1": "Ekstern Validering - Type \"abc\" for et gyldig svar ",
"INPUT2": "Positivt eller negativt nummer -- input type=\"number\" -- Feil på ikke-numeriske tegn ",
"INPUT1": "Ekstern Validering - Type 'abc' for et gyldig svar ",
"INPUT2": "Positivt eller negativt nummer -- input type='number' -- Feil på ikke-numeriske tegn ",
"INPUT3": "Flyttalssutvalg (heltall ekskludert) -- between_num:x,y eller min_num:x|max_num:y ",
"INPUT4": "Multiple Valideringer + Tilpasset Regex av dato kode (YYWW)",
"INPUT5": "Epost",
Expand All @@ -77,7 +77,7 @@
"INPUT10": "ISO dato (yyyy-mm-dd)",
"INPUT11": "US LONG dato (mm/dd/yyyy)",
"INPUT12": "Tid (hh:mm eller hh:mm:ss) -- IKKE Påkrevd",
"INPUT13": "AlphaDashSpaces + Påkrevd + Minimum(5) Tegn -- MÅ BRUKE: validation-error-to=\" \"",
"INPUT13": "AlphaDashSpaces + Påkrevd + Minimum(5) Tegn -- MÅ BRUKE: validation-error-to=' '",
"INPUT14": "Alfanumerisk + Påkrevd -- NG-DISABLED",
"INPUT15": "Passord",
"INPUT16": "Passord bekreftelse",
Expand Down
Loading

0 comments on commit 1b74d9e

Please sign in to comment.