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

Commit

Permalink
Added friendly-name attribute on element
Browse files Browse the repository at this point in the history
  • Loading branch information
ghiscoding committed May 4, 2015
1 parent 4972810 commit 5c4c8bf
Show file tree
Hide file tree
Showing 16 changed files with 99 additions and 46 deletions.
12 changes: 8 additions & 4 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,26 +82,30 @@ myApp.controller('CtrlValidationService', ['$scope', '$translate', 'validationSe
var myValidation = new validationService();

// you can create indepent call to the validation service
// also below the multiple properties available
myValidation.addValidator({
elmName: 'input2',
// friendlyName: $translate.instant('FIRST_NAME'),
debounce: 3000,
scope: $scope,
rules: 'numeric_signed|required'
});

// you can also chain validation service and add multiple validators at once
// we optionally start by defining some global options. Note: each validator can overwrite individually these properties (ex.: validatorX can have a `debounce` different than the global set)
// there is 2 ways to write a call... #1 with elementName & rules defined as 2 strings arguments ... #2 with 1 object as argument (with defined property names)
// #1 .addValidtor('myElementName', 'myRules') ... #2 .addValidator({ elmName: 'inputX', rules: 'myRules'})
// there is 2 ways to write a call... #1-2 with elementName & rules defined as 2 or 3 strings arguments ... #3 with 1 object as argument (with defined property names)
// #1 .addValidtor('myElementName', 'myRules')
// #2 .addValidtor('myElementName', 'myRules', 'myFriendlyName')
// #3 .addValidator({ elmName: 'inputX', rules: 'myRules'})
// the available object properties are the exact same set as the directive except that they are camelCase
myValidation
.setGlobalOptions({ debounce: 1500, scope: $scope })
.addValidator('input3', 'float_signed|between_num:-0.6,99.5|required')
.addValidator('input4', 'exact_len:4|regex:YYWW:=^(0[9]|1[0-9]|2[0-9]|3[0-9])(5[0-2]|[0-4][0-9])$:regex|required|integer')
.addValidator('input5', 'email|required|min_len:6')
.addValidator('input5', 'email|required|min_len:6', $translate.instant('INPUT5')) // 3rd argument being the Friendly name
.addValidator('input6', 'url|required')
.addValidator('input7', 'ipv4|required')
.addValidator('input8', 'credit_card|required')
.addValidator('input8', 'credit_card|required', $translate.instant('INPUT8')) // 3rd argument being the Friendly name
.addValidator('input9', 'between_len:2,6|required')
.addValidator('input10', 'date_iso|required')
.addValidator('input11', 'date_us_long|required')
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.3.21",
"version": "1.3.22",
"author": "Ghislain B.",
"description": "Angular-Validation Directive and Service (ghiscoding)",
"main": [
Expand Down
3 changes: 2 additions & 1 deletion changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ Angular-Validation change logs
1.3.18 (2015-04-19) Fixed issue #20 - Error messages shown on submit are non-understandable, this was fixed using $translate promises instead of $translate.instant(). Fixed a few error display on the validationSummary() and checkFormValidity(). Also merged #27 to add Russian
1.3.19 (2015-04-20) Fixed issue #28 - unbind all 'blur' in cancelValidation() might affect other modules
1.3.20 (2015-04-21) Fixed issue #26 - validation of forms inside ng-repeat (added sample `dynamicFormView` in `more-examples` folder). And again issue #28 - unbind all 'blur' in cancelValidation() might affect other modules.
1.3.21 (2015-04-29) Moved the Alternate Text inside the $translate promise as well which removes possible delay of non-translated text appearing as alternate text (this will not affect regular text, or already translated text). Also cleanup code and made my Gulp task even more automated.
1.3.21 (2015-04-29) Moved the Alternate Text inside the $translate promise as well which removes possible delay of non-translated text appearing as alternate text (this will not affect regular text, or already translated text). Also cleanup code and made my Gulp task even more automated.
1.3.22 (2015-05-03) Added new element attribute of `friendly-name` which is used ONLY in the ValidationSummary, this friendly name is to give a better element name display, which also support translation, inside the ValidationSummary instead of just "input1" (see ValidationSummary for more details).
8 changes: 4 additions & 4 deletions dist/angular-validation.min.js

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions locales/validation/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@
"INPUT17": "Alphanumeric + Exactly(3) + Required -- debounce(5sec)",
"INPUT18": "Date ISO (yyyy-mm-dd) -- minimum condition >= 2001-01-01 ",
"INPUT19": "Date US SHORT (mm/dd/yy) -- between the dates 12/01/99 and 12/31/15",
"FIRST_NAME": "First Name",
"LAST_NAME": "Last Name",
"SAVE": "Save",
"SELECT1": "Required (select) -- validation with (blur) EVENT",
"SHOW_VALIDATION_SUMMARY": "Show Validation Summary"
Expand Down
2 changes: 2 additions & 0 deletions locales/validation/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@
"INPUT17": "Alfanúmerico + Exactamente(3) + Requerido -- debounce(5sec)",
"INPUT18": "Fecha formato ISO (yyyy-mm-dd) -- Condición minima >= 2001-01-01 ",
"INPUT19": "Fecha formato US corto (mm/dd/yy) -- entre las fechas 12/01/99 and 12/31/15",
"FIRST_NAME": "Nombre",
"LAST_NAME": "Apellido",
"SAVE": "Guardar",
"SELECT1": "Requerido (select) -- validación con (blur) EVENT",
"SHOW_VALIDATION_SUMMARY": "Mostar el resumén de validación"
Expand Down
2 changes: 2 additions & 0 deletions locales/validation/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@
"INPUT17": "Alphanumérique + Exactement(3) + Requis -- debounce(5sec)",
"INPUT18": "Date ISO (yyyy-mm-dd ) -- condition minimal >= 2001-01-01 ",
"INPUT19": "Date US COURT (mm/dd/yy) -- entre les dates 12/01/99 et 12/31/15",
"FIRST_NAME": "Prénom",
"LAST_NAME": "Nom de Famille",
"SAVE": "Sauvegarder",
"SELECT1": "Requis (select) -- validation avec EVENT (blur)",
"SHOW_VALIDATION_SUMMARY": "Afficher le Résumé de Validation"
Expand Down
2 changes: 2 additions & 0 deletions locales/validation/no.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@
"INPUT17": "Alfanumerisk + Nøyaktig(3) + Påkrevd -- debounce(5sec)",
"INPUT18": "ISO dato (yyyy-mm-dd) -- minimum >= 2001-01-01 ",
"INPUT19": "US SHORT dato (mm/dd/yy) -- mellom 12/01/99 og 12/31/15",
"FIRST_NAME": "Fornavn",
"LAST_NAME": "Etternavn",
"SAVE": "Lagre",
"SELECT1": "Påkrevd (select) -- validering med (blur) EVENT",
"SHOW_VALIDATION_SUMMARY": "Vis Valideringsoppsummering"
Expand Down
2 changes: 2 additions & 0 deletions locales/validation/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@
"INPUT17": "Буквенно-цифровой + Точно(3) + Обязательно -- debounce(5sec)",
"INPUT18": "Дата ISO (yyyy-mm-dd) -- минимальное условие >= 2001-01-01 ",
"INPUT19": "Дата US SHORT (mm/dd/yy) --между датами 12/01/99 и 12/31/15",
"FIRST_NAME": "Имя",
"LAST_NAME": "Фамилия",
"SAVE": "Сохранить",
"SELECT1": "Обязательное (select) -- проверка по СОБЫТИЮ (blur)",
"SHOW_VALIDATION_SUMMARY": "Показать результаты проверки значений"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-validation-ghiscoding",
"version": "1.3.21",
"version": "1.3.22",
"author": "Ghislain B.",
"description": "Angular-Validation Directive and Service (ghiscoding)",
"main": "app.js",
Expand Down
Loading

0 comments on commit 5c4c8bf

Please sign in to comment.