-
+
-
+
-
+
-
-
-
-
-
-
-
-
+
+
-
+
+
+
+
diff --git a/locales/validation/en.json b/locales/validation/en.json
index 853080f..619b43f 100644
--- a/locales/validation/en.json
+++ b/locales/validation/en.json
@@ -36,10 +36,10 @@
"INVALID_IBAN": "Must a valid IBAN. ",
"INVALID_INPUT_MATCH": "Confirmation field does not match specified field \":param\". ",
"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_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_MAX_CHAR": "May not be greater than :param characters. ",
"INVALID_MAX_NUM": "Needs to be a numeric value, equal to, or lower than :param. ",
@@ -70,7 +70,7 @@
"INPUT13": "AlphaDashSpaces + Required + Minimum(5) Characters -- MUST USE: validation-error-to=\" \"",
"INPUT14": "Alphanumeric + Required -- NG-DISABLED",
"INPUT15": "Password",
- "INPUT16": "Password Confirmation",
+ "INPUT16": "Password Confirmation",
"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",
diff --git a/locales/validation/fr.json b/locales/validation/fr.json
index acafe85..11b68e4 100644
--- a/locales/validation/fr.json
+++ b/locales/validation/fr.json
@@ -32,14 +32,14 @@
"INVALID_EMAIL": "Doit être une adresse courriel valide. ",
"INVALID_EXACT_LEN": "Doit être d'une longueur fixe de :param caractères. ",
"INVALID_FLOAT": "Doit être obligatoirement un nombre flottant positif (nombre entier exclu). ",
- "INVALID_FLOAT_SIGNED": "Doit être obligatoirement un nombre flottant positif ou négatif (nombre entier exclu). ",
+ "INVALID_FLOAT_SIGNED": "Doit être obligatoirement un nombre flottant positif ou négatif (nombre entier exclu). ",
"INVALID_IBAN": "Doit être un IBAN valide. ",
- "INVALID_INPUT_MATCH": "Le champs de confirmation ne correspond pas au champs spécifié \":param\". ",
+ "INVALID_INPUT_MATCH": "Le champs de confirmation ne correspond pas au champs spécifié \":param\". ",
"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_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_MAX_CHAR": "Doit être plus petit que :param caractères. ",
"INVALID_MAX_NUM": "Doit être une valeur numérique, égale ou inférieure à :param. ",
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..111ed51
--- /dev/null
+++ b/package.json
@@ -0,0 +1,31 @@
+{
+ "name": "ghiscoding.angular-validation",
+ "version": "1.3.10",
+ "author": "Ghislain B.",
+ "description": "Angular-Validation Directive and Service (ghiscoding)",
+ "main": "app.js",
+ "dependencies": {
+ "gulp": "^3.8.11"
+ },
+ "devDependencies": {
+ "del": "^1.1.1",
+ "gulp": "^3.8.11",
+ "gulp-concat": "^2.5.2",
+ "gulp-deporder": "^1.0.0",
+ "gulp-header": "^1.2.2",
+ "gulp-strip-debug": "^1.0.2",
+ "gulp-uglify": "^1.1.0"
+ },
+ "scripts": {
+ "test": "echo \"Error: no test specified\" && exit 1"
+ },
+ "keywords": [
+ "angular-validation"
+ ],
+ "license": "MIT",
+ "homepage": "http://github.com/ghiscoding/angular-validation",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/ghiscoding/angular-validation"
+ }
+}
diff --git a/readme.md b/readme.md
index e040553..d134447 100644
--- a/readme.md
+++ b/readme.md
@@ -1,5 +1,5 @@
#Angular Validation (Directive / Service)
-`Version: 1.3.9`
+`Version: 1.3.10`
### Form validation after user inactivity of default 1sec. (customizable timeout)
Forms Validation with Angular made easy! Angular-Validation is an angular directive/service with locales (languages) with a very simple approach of defining your `validation=""` directly within your element to validate (input, textarea, etc) and...that's it!!! The directive/service will take care of the rest!
@@ -8,13 +8,13 @@ The base concept is not new, it comes from the easy form input validation approa
For a smoother user experience, I also added validation on inactivity (timer/debounce). So validation will not bother the user while he is still typing... though as soon as the user pauses for a certain amount of time, then validation comes into play. It's worth knowing that this inactivity timer is only available while typing, if user focuses away from his input (onBlur) it will then validate instantly.
-Supporting AngularJS 1.3.x
+Supporting AngularJS 1.3.x
*current code should work with 1.2.x just the same but is no more verified*
Now support Service using the same functionality as the Directive.
Huge rewrite to have a better code separation and also adding support to Service functionality. Specifically the `validation-rules` was separated to add rules without affecting the core while `validation-common` is for shared functions (shared by Directive/Service).
-[Validation summary](#validation-summary) was also recently added to easily show all validation errors that are still active on the form.
+[Validation summary](#validation-summary) was also recently added to easily show all validation errors that are still active on the form and you can also use 2 ways of dealing with the [Submit](#submit) button.
## Live Demo
@@ -32,7 +32,9 @@ bower install ghiscoding.angular-validation
Include it in your app project
--------------------
-The validation scripts are now available in 2 formats: minified (`dist/*.js`) or uncompressed (`src/*.js`). The minified scripts are available in 4 individual scripts (same as `scr/` but minified) or as an all in 1 file that englobes them all into 1 minified file. The Directive and/or Service are totally independent and could be called together or separately BUT you will still need the `validation-rules` and `validation-common` files. Also note that `angular-translate` is also a [dependency](#dependencies).
+The angular-validation scripts are now available in 2 formats: uncompressed (`src/*.js`) or minified (`dist/angular-validation.min.js`). The minified script englobes all uncompressed scripts. Also note that `angular-translate` (3rd party app) is also a [dependency](#dependencies).
+
+*If you use the uncompressed scripts, it is worth to know that the Directive and/or Service are totally independent and could be called together or separately BUT you will still need the `validation-rules` and `validation-common` files.*
```javascript
// include it your app module ( we need both Translate & Validation)
var myApp = angular.module('myApp', ['ngRoute', 'ghiscoding.validation', 'pascalprecht.translate']);
@@ -52,18 +54,19 @@ myApp.config(function ($translateProvider) {
```
```html
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
```
## Requirements
-Angular-Validation requires the element which will use validation to have an html `name=""` attribute, so that in the background it can use this name to create and show an error into a `` which will directly follow your form input. For example: ``.
+Angular-Validation requires the element which will use validation to have an html `name=""` attribute, so that in the background it can use this name to create and show an error into a `` which will directly follow your form input. For example: ``.
*The necessity of `name=""` attribute is new since version 1.3.4+, prior to this change we were asking the user to create his own `` for error displaying. In other words, the `` is now optional, but the `name=""` attribute becomes mandatory and will throw an error if omitted*
@@ -98,14 +101,14 @@ P.S. For real live sample, see the [live plunker demo](#plunker) or download the
-
-
+
@@ -131,7 +134,7 @@ P.S. For real live sample, see the [live demo](#plunker) or download the Github
// start by creating the service
var myValidation = new validationService();
- // you can create indepent call to the validation service
+ // you can create indepent call to the validation service
myValidation.addValidator({
elmName: 'input2',
debounce: 3000,
@@ -145,7 +148,7 @@ P.S. For real live sample, see the [live demo](#plunker) or download the Github
// #1 .addValidtor('myElementName', 'myRules') ... #2 .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 })
+ .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');
@@ -153,14 +156,36 @@ P.S. For real live sample, see the [live demo](#plunker) or download the Github
// you can also remove a Validator with an ngClick or whichever way you prefer by calling .removeValidator()
$scope.removeInputValidator = function ( elmName ) {
// remove a single element (string) OR you can also remove multiple elements through an array type .removeValidator(['input2','input3'])
- myValidation.removeValidator(elmName);
+ myValidation.removeValidator(elmName);
};
```
+
+## Form Submitting and Validation
+The Angular-Validation concept was first introduced with the use `ngDisabled` on the submit button, but this might not always be the best option so as a another feature we could simply leave the submit button available but run an extra function to check the form validation before proceeding with our submit (that function is available through the ValidationService).
+
+*You could also use the [Validation summary](#validation-summary) for displaying all errors as a header or even a footer*
+```html
+
+
+
+
+
+```
+```javascript
+// Option #2 will need to call the `checkFormValidity()` function checking the form before doing a real submit
+$scope.submitForm = function() {
+ var myValidation = new validationService();
+ if(myValidation.checkFormValidity($scope.form1)) {
+ // proceed with submit
+ }
+}
+```
+
## Validation Summary
-Display a validation summary of all the current form errors. Validation summary can ben called through 2 properties `$scope.$validationSummary` and `$scope.formName.$validationSummary`(the latter will only works if your html Form object has a `name=""` attribute. For example `