Skip to content

Commit ae14eab

Browse files
committed
end of life...
1 parent ada0d63 commit ae14eab

39 files changed

+7246
-259
lines changed

README.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
# jQuery Form Validator
22

3-
jQuery Form Validator is a **feature rich and multilingual** jQuery plugin that makes it easy to validate user input while keeping your HTML markup clean from javascript code. This plugin approaches validation as a form of configuration that should'nt require any knowledge of JavaScript nor programming.
3+
*Validation framework that let's you configure, rather than code, your validation logic.*
44

5-
**Form demos and full documentation available at http://formvalidator.net/**
5+
I started writing this plugin back in 2009 and it has given me much joy over the year. But all good things must come to an end and now it's time for this plugin to pull in its oars and go down with history.
6+
7+
**NOTICE!** This plugin is no longer being developed! It supports jQuery v. 1.8 >= 2.2.4. No pull requests will become merged in but feel free to fork and do whatever you like!
68

79
[![Travis](https://travis-ci.org/victorjonsson/jQuery-Form-Validator.svg)](https://travis-ci.org/victorjonsson/jQuery-Form-Validator/builds/)
810

@@ -78,7 +80,7 @@ Read the documentation for the default features at [http://formvalidator.net/#de
7880
* **strength***Validate the strength of a password*
7981
* **server***Validate value of input on server side*
8082
* **letternumeric***Validate that the input value consists out of only letters and/or numbers*
81-
* **recaptcha** - *Validate Google [reCaptcha 2](https://www.google.com/recaptcha/intro/index.html)*
83+
* **recaptcha** - *Validate Google [reCaptcha 2](https://www.google.com/recaptcha/intro/index.html)*
8284

8385
Read the documentation for the security module at [http://formvalidator.net/#security-validators](http://formvalidator.net/#security-validators)
8486

@@ -133,8 +135,8 @@ Read the documentation for the Swedish module at [http://formvalidator.net/#swed
133135

134136
### Module: uk
135137
* **ukvatnumber**
136-
* **uknin**
137-
* **ukutr**
138+
* **uknin**
139+
* **ukutr**
138140

139141
Read the documentation for the UK module at [http://formvalidator.net/#uk-validators](http://www.formvalidator.net/#country-specific-validators_uk)
140142

@@ -143,12 +145,12 @@ Read the documentation for the UK module at [http://formvalidator.net/#uk-valida
143145
* **cep**
144146
* **cpf**
145147

146-
### Module: poland
148+
### Module: poland
147149
* **plpesel** - *validate polish personal identity number (in Polish identity cards)*
148150
* **plnip** - *validate polish VAT identification number*
149151
* **plregon** - *validate polish bussiness identity number*
150-
151-
### Module: color
152+
153+
### Module: color
152154
* **hex** - *validate hex color format*
153155
* **rgb** - *validate rgb color format*
154156
* **rgba** - *validate rgba color format*

form-validator/brazil.js

Lines changed: 136 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,138 @@
1-
/** File generated by Grunt -- do not modify
2-
* JQUERY-FORM-VALIDATOR
1+
(function (root, factory) {
2+
if (typeof define === 'function' && define.amd) {
3+
// AMD. Register as an anonymous module unless amdModuleId is set
4+
define(["jquery"], function (a0) {
5+
return (factory(a0));
6+
});
7+
} else if (typeof module === 'object' && module.exports) {
8+
// Node. Does not work with strict CommonJS, but
9+
// only CommonJS-like environments that support module.exports,
10+
// like Node.
11+
module.exports = factory(require("jquery"));
12+
} else {
13+
factory(root["jQuery"]);
14+
}
15+
}(this, function (jQuery) {
16+
17+
/**
18+
* jQuery Form Validator Module: Brazil
19+
* ------------------------------------------
20+
* Created by Eduardo Cuducos <http://cuducos.me/>
321
*
4-
* @version 2.3.77
5-
* @website http://formvalidator.net/
6-
* @author Victor Jonsson, http://victorjonsson.se
7-
* @license MIT
22+
* This form validation module adds validators typically used on
23+
* websites in the Brazil. This module adds the following validators:
24+
* - cpf
25+
* - cep
26+
* - brphone
27+
*
28+
* @website http://formvalidator.net/#brazil-validators
29+
* @license MIT
830
*/
9-
!function(a,b){"function"==typeof define&&define.amd?define(["jquery"],function(a){return b(a)}):"object"==typeof module&&module.exports?module.exports=b(require("jquery")):b(a.jQuery)}(this,function(a){!function(a){a.formUtils.registerLoadedModule("brazil"),a.formUtils.addValidator({name:"cpf",validatorFunction:function(a){var b=a.replace(/\D/g,""),c=0,d=0,e=0,f=0;if(11!==b.length||"00000000000"===b)return!1;for(i=1;i<=9;i++)c+=parseInt(b.substring(i-1,i))*(11-i);if(e=10*c%11,e>=10&&(e=0),e!==parseInt(b.substring(9,10)))return!1;for(i=1;i<=10;i++)d+=parseInt(b.substring(i-1,i))*(12-i);return f=10*d%11,f>=10&&(f=0),f===parseInt(b.substring(10,11))},errorMessage:"",errorMessageKey:"badBrazilCPFAnswer"}),a.formUtils.addValidator({name:"brphone",validatorFunction:function(a){return!!a.match(/^(\+[\d]{1,3}[\s]{0,1}){0,1}(\(){0,1}(\d){2}(\)){0,1}(\s){0,1}(\d){4,5}([-. ]){0,1}(\d){4}$/g)},errorMessage:"",errorMessageKey:"badBrazilTelephoneAnswer"}),a.formUtils.addValidator({name:"cep",validatorFunction:function(a){return!!a.match(/^(\d){5}([-. ]){0,1}(\d){3}$/g)},errorMessage:"",errorMessageKey:"badBrazilCEPAnswer"})}(a)});
31+
(function($) {
32+
33+
$.formUtils.registerLoadedModule('brazil');
34+
35+
$.formUtils.addValidator({
36+
name : 'cpf',
37+
validatorFunction : function(string) {
38+
39+
// Based on this post from DevMedia:
40+
// http://www.devmedia.com.br/validar-cpf-com-javascript/23916
41+
42+
// clean up the input (digits only) and set some support vars
43+
var cpf = string.replace(/\D/g,'');
44+
var sum1 = 0;
45+
var sum2 = 0;
46+
var remainder1 = 0;
47+
var remainder2 = 0;
48+
49+
// skip special cases
50+
if (cpf.length !== 11 || cpf === '00000000000') {
51+
return false;
52+
}
53+
54+
// check 1st verification digit
55+
for (i = 1; i<= 9; i++) {
56+
sum1 += parseInt(cpf.substring(i - 1, i)) * (11 - i);
57+
}
58+
remainder1 = (sum1 * 10) % 11;
59+
if (remainder1 >= 10) {
60+
remainder1 = 0;
61+
}
62+
if (remainder1 !== parseInt(cpf.substring(9, 10))) {
63+
return false;
64+
}
65+
66+
// check 2nd verification digit
67+
for (i = 1; i <= 10; i++) {
68+
sum2 += parseInt(cpf.substring(i - 1, i)) * (12 - i);
69+
}
70+
remainder2 = (sum2 * 10) % 11;
71+
if (remainder2 >= 10) {
72+
remainder2 = 0;
73+
}
74+
if (remainder2 !== parseInt(cpf.substring(10, 11))) {
75+
return false;
76+
}
77+
78+
return true;
79+
80+
},
81+
errorMessage : '',
82+
errorMessageKey: 'badBrazilCPFAnswer'
83+
84+
});
85+
86+
$.formUtils.addValidator({
87+
name : 'brphone',
88+
validatorFunction : function(string) {
89+
90+
// validates telefones such as (having X as numbers):
91+
// (XX) XXXX-XXXX
92+
// (XX) XXXXX-XXXX
93+
// XX XXXXXXXX
94+
// XX XXXXXXXXX
95+
// XXXXXXXXXX
96+
// XXXXXXXXXXX
97+
// +XX XX XXXXX-XXXX
98+
// +X XX XXXX-XXXX
99+
// And so on…
100+
101+
if (string.match(/^(\+[\d]{1,3}[\s]{0,1}){0,1}(\(){0,1}(\d){2}(\)){0,1}(\s){0,1}(\d){4,5}([-. ]){0,1}(\d){4}$/g)) {
102+
return true;
103+
}
104+
105+
return false;
106+
107+
},
108+
errorMessage : '',
109+
errorMessageKey: 'badBrazilTelephoneAnswer'
110+
111+
});
112+
113+
$.formUtils.addValidator({
114+
name : 'cep',
115+
validatorFunction : function(string) {
116+
117+
// validates CEP such as (having X as numbers):
118+
// XXXXX-XXX
119+
// XXXXX.XXX
120+
// XXXXX XXX
121+
// XXXXXXXX
122+
123+
if (string.match(/^(\d){5}([-. ]){0,1}(\d){3}$/g)) {
124+
return true;
125+
}
126+
127+
return false;
128+
129+
},
130+
errorMessage : '',
131+
errorMessageKey: 'badBrazilCEPAnswer'
132+
133+
});
134+
135+
})(jQuery);
136+
137+
138+
}));

0 commit comments

Comments
 (0)