From 4da9b65c0284a69b79dc6f09e4ca3e345b7ef718 Mon Sep 17 00:00:00 2001 From: Victor Michnowicz Date: Thu, 7 Feb 2013 17:57:01 -0500 Subject: [PATCH 1/8] Update docs --- README.md | 14 +++++++------- package.json | 8 ++++---- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 97ad261..a698e7b 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ jQuery Form Validate uses the data attributes applied to your form inputs input ### messageParent -CSS selector of parent element of message (success or failure) messages. By default this is `div`. +CSS selector of parent element of success and failure message. By default this is `div`. This selector is relative to each input. Starting at the input we go through each parent and see if it matches the provided selector. This will tell us were to place each error and success messages. For this reason it is nice to wrap each set of labels and inputs in some sort of container element. ### messageElement @@ -62,25 +62,25 @@ Boolean option to display success messages. Defaults to `false`. ### messageFailureClass -CSS class(es) applied to failure messages. Defaults to `error`. Multiple CSS classes can be applied by through space deliineation i.e. `error error-text`. +CSS class(es) applied to failure messages. Defaults to `error`. Multiple CSS classes can be applied by through space delineation i.e. `error error-text`. ### messageSuccessClass -CSS class(es) applied to success messages. Defaults to `success`. Multiple CSS classes can be applied by through space deliineation i.e. `success success-text`. +CSS class(es) applied to success messages. Defaults to `success`. Multiple CSS classes can be applied by through space delineation i.e. `success success-text`. ### inputFailureClass -CSS class(es) added to inputs that did not pass validation. Defaults to `error`. Multiple CSS classes can be applied by through space deliineation i.e. `error error-text`. +CSS class(es) added to inputs that did not pass validation. Defaults to `error`. Multiple CSS classes can be applied by through space delineation i.e. `error error-text`. ### inputSuccessClass -CSS class added to inputs that did pass validation. Defaults to `success`. Multiple CSS classes can be applied by through space deliineation i.e. `success success-text`. +CSS class added to inputs that did pass validation. Defaults to `success`. Multiple CSS classes can be applied by through space delineation i.e. `success success-text`. ### language -Set the language for error and success messages. Defaults to `en` for English. Deutsch `de`, English `en`, Espańol `es`, and Pirate `pirage` are available. +Set the language for error and success messages. Defaults to `en` for English. Deutsch `de`, English `en`, Español `es`, and Pirate `pirate` are available. -## Publically Available Methods +## Publicly Available Methods ### preProcess [ function *function(form, options, inputFailureClass, inputSuccessClass, messageFailureClass, messageSuccessClass, messageElement)* ] diff --git a/package.json b/package.json index 70d8ef5..1338d3c 100644 --- a/package.json +++ b/package.json @@ -1,21 +1,21 @@ { "name": "formvalidate", - "version": "0.1.1", "title": "jQuery Form Validate", + "description": "jQuery Form Validate is a simple form validation plugin that allows you to easily validate your forms by applying various HTML data attributes.", + "version": "0.2", "author": { "name": "Victor Michnowicz", "url": "http://www.vmichnowicz.com/" }, "licenses": [ { - "type": "MIT", - "url": "http://opensource.org/licenses/MIT" + "type": "MIT", + "url": "http://opensource.org/licenses/MIT" } ], "dependencies": { "jquery": ">1.4.3" }, - "description": "", "keywords": [ "form", "validation", From 8f9e53a2a083e70fc7a2242a7e32cb7008ebb5e5 Mon Sep 17 00:00:00 2001 From: Victor Michnowicz Date: Thu, 7 Feb 2013 17:58:13 -0500 Subject: [PATCH 2/8] Update to version 0.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1338d3c..ab4f9ab 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "formvalidate", "title": "jQuery Form Validate", "description": "jQuery Form Validate is a simple form validation plugin that allows you to easily validate your forms by applying various HTML data attributes.", - "version": "0.2", + "version": "0.3", "author": { "name": "Victor Michnowicz", "url": "http://www.vmichnowicz.com/" From 5b0dfc565bb84a682d95d45334cc9f6997de4a48 Mon Sep 17 00:00:00 2001 From: Victor Michnowicz Date: Thu, 7 Feb 2013 18:07:16 -0500 Subject: [PATCH 3/8] Update version, meta tag --- package.json => formvalidate.jquery.json | 2 +- index.html | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) rename package.json => formvalidate.jquery.json (97%) diff --git a/package.json b/formvalidate.jquery.json similarity index 97% rename from package.json rename to formvalidate.jquery.json index ab4f9ab..a3b545f 100644 --- a/package.json +++ b/formvalidate.jquery.json @@ -2,7 +2,7 @@ "name": "formvalidate", "title": "jQuery Form Validate", "description": "jQuery Form Validate is a simple form validation plugin that allows you to easily validate your forms by applying various HTML data attributes.", - "version": "0.3", + "version": "0.3.1", "author": { "name": "Victor Michnowicz", "url": "http://www.vmichnowicz.com/" diff --git a/index.html b/index.html index e276ab5..c48f69b 100644 --- a/index.html +++ b/index.html @@ -3,6 +3,7 @@ jQuery Form Validate + From 3c4153b422162ec4e640abeeada83d124030de41 Mon Sep 17 00:00:00 2001 From: Victor Michnowicz Date: Thu, 7 Feb 2013 21:36:31 -0500 Subject: [PATCH 4/8] Update bugs, docs, demo links & add custom validation function --- formvalidate.jquery.json | 5 ++++- index.html | 10 +++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/formvalidate.jquery.json b/formvalidate.jquery.json index a3b545f..b651e0b 100644 --- a/formvalidate.jquery.json +++ b/formvalidate.jquery.json @@ -2,7 +2,7 @@ "name": "formvalidate", "title": "jQuery Form Validate", "description": "jQuery Form Validate is a simple form validation plugin that allows you to easily validate your forms by applying various HTML data attributes.", - "version": "0.3.1", + "version": "0.3.2", "author": { "name": "Victor Michnowicz", "url": "http://www.vmichnowicz.com/" @@ -22,6 +22,9 @@ "validate" ], "homepage": "https://github.com/vmichnowicz/jquery.formvalidate", + "bugs": "https://github.com/vmichnowicz/jquery.formvalidate/issues", + "docs": "https://github.com/vmichnowicz/jquery.formvalidate/wiki", + "demo": "http://www.vmichnowicz.com/examples/formvalidate/index.html", "maintainers": [ { "name": "Victor Michnowicz", diff --git a/index.html b/index.html index c48f69b..d17dbcb 100644 --- a/index.html +++ b/index.html @@ -99,7 +99,7 @@
- +
@@ -255,6 +255,11 @@ onSuccess: function(form) { alert('Form #2 is valid!'); }, + validations: { + isNot: function(input, params) { + return $.inArray(input.toLowerCase(), params); + } + }, localization: { en: { success: { @@ -277,6 +282,9 @@ failure: { email: function(title, value, name, input) { return 'There is no way that email ' + value + ' is valid.'; + }, + isNot: function(title, value, name, input) { + return 'That name is not original enough.'; } } } From 363b16096cb5c7ec9a8aa1b9200239c439f82b19 Mon Sep 17 00:00:00 2001 From: Victor Michnowicz Date: Thu, 7 Feb 2013 22:17:43 -0500 Subject: [PATCH 5/8] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a698e7b..e6c0d91 100644 --- a/README.md +++ b/README.md @@ -12,9 +12,9 @@ Access a [live demo](http://www.vmichnowicz.com/examples/formvalidate/index.html jQuery Form Validate is a jQuery plugin that helps validate your HTML forms. It takes validation rules from the HTML 5 data attributes applied to each input. For example, let's assume we have a `first_name` text input in our form. We want our first name field to be required and have a length of at least 5 characters. The HTML markup would look like this: -```` +``` -```` +``` ## Filters & Validations @@ -229,4 +229,4 @@ This function checks to see if a value is greater than the provided number. * required * requiredIf * lessThan - * greaterThan \ No newline at end of file + * greaterThan From a6e0c286e37213ced72187a35f2e8deb6992fee7 Mon Sep 17 00:00:00 2001 From: Victor Michnowicz Date: Wed, 22 May 2013 22:37:09 -0400 Subject: [PATCH 6/8] Get input title from associated label --- jquery.formvalidate.js | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/jquery.formvalidate.js b/jquery.formvalidate.js index 14cefe9..fa8eb5c 100644 --- a/jquery.formvalidate.js +++ b/jquery.formvalidate.js @@ -301,15 +301,31 @@ // If title had not yet been created for this input if ( ! ('title' in inputs[attrName]) ) { + var title = null; + // Check for title data-title attribute if ('title' in data) { - inputs[attrName].title = data.title; + title = data.title; } - // If no title data-title attribute is found, use the inputs name attribute - else { + + // If still no title, use the inputs title attribute + if ( ! title ) { // Look for the first input that has this same name attribe and a title attribute and grab its title - inputs[attrName].title = $(':input[name="' + attrName + '"][title!=""]:first').attr('title'); + title = $(':input[name="' + attrName + '"][title!=""]:first').attr('title'); + } + + // If still no title, check associated label + if ( ! title ) { + var id = $(':input[name="' + attrName + '"][id!=""]:first').attr('id'); + title = $('label[for="' + id + '"]').text(); + } + + // If still no title, check parent label + if ( ! title ) { + title = $('label :input[name="' + attrName + '"]:first').closest('label').text(); } + + inputs[attrName].title = title; } // Set success and failure in object From ccf70af11184dfc6c63ada1c3b87f0388ec979f0 Mon Sep 17 00:00:00 2001 From: Victor Michnowicz Date: Fri, 24 May 2013 18:19:12 -0400 Subject: [PATCH 7/8] Update version number --- formvalidate.jquery.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/formvalidate.jquery.json b/formvalidate.jquery.json index b651e0b..9647d9a 100644 --- a/formvalidate.jquery.json +++ b/formvalidate.jquery.json @@ -2,7 +2,7 @@ "name": "formvalidate", "title": "jQuery Form Validate", "description": "jQuery Form Validate is a simple form validation plugin that allows you to easily validate your forms by applying various HTML data attributes.", - "version": "0.3.2", + "version": "0.4.2", "author": { "name": "Victor Michnowicz", "url": "http://www.vmichnowicz.com/" From 9775eff71dd3816aa635fbc1c1dabf22cd1f7d92 Mon Sep 17 00:00:00 2001 From: lpfrenette Date: Wed, 12 Feb 2014 22:53:11 -0500 Subject: [PATCH 8/8] fr.js --- fr.js | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 fr.js diff --git a/fr.js b/fr.js new file mode 100644 index 0000000..de4d55e --- /dev/null +++ b/fr.js @@ -0,0 +1,30 @@ +/** + * jQuery Form Validate French error message translations (translation by https://github.com/lpfrenette) + * + * Include this file *after* the jquery.formvalidate.js in document + */ +jQuery.extend(true, jQuery.fn.formvalidate.options.localization, { + fr: { + failure: { + 'default': '{0} est invalide.', + betweenNumeric: '{0} doit ĂȘtre entre {2} et {3}.', + date: '{0} n\'est pas une date valide.', + email: '{1} n\'est pas un courriel valide.', + numChars: '{0} doit ĂȘtre exactement {2}.', + minChars: '{0} doit ĂȘtre au moins {2}.', + maxChars: '{0} ne peut ĂȘtre supĂ©rieur Ă  {2}.', + numOptions: 'Ahoy , yee must select exactly {2} options.', + minOptions: 'Vous devez sĂ©lectionner au moins {2} options.', + maxOptions: 'Vous ne pouvez sĂ©lectionner plus de {2} options.', + 'int': '{0} n\'est pas un entier.', + 'float': '{0} n\'est pas un nombre valide.', + required: '{0} est requis.', + requiredIf: '{0} est requis.', + lessThan: '{0} doit ĂȘtre moins de {2}.', + greaterThan: '{0} doit ĂȘtre suppĂ©rieur Ă  {2}.' + }, + success: { + 'default': '{0} est valide!' + } + } +});