Skip to content

Commit cbb8e02

Browse files
committed
started with new examples
1 parent 2f11ea9 commit cbb8e02

19 files changed

+500
-1751
lines changed

README.md

Lines changed: 16 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,16 @@
1-
<<<<<<< .merge_file_MDtscE
2-
This plugin was created to minimize javascript logic in the html code when dealing with front-end validation of form data.
3-
4-
[Live example can be viewed here](http://victorjonsson.se/jquery-form-validator/?from=github)
5-
=======
6-
**jQuery Form Validator** is a feature rich jQuery plugin that makes it easy to validate user input in HTML forms
7-
while keeping your markup clean from javascript code. Even though this plugin has **a wide range of validation functions**
8-
it's designed to require as little bandwidth as possible (which makes it very suitable for **mobile websites**).
9-
This is achieved by grouping together validation functions in "modules", making it possible for the programmer
10-
to load **only those functions that's needed** to validate a particular form.
11-
>>>>>>> .merge_file_lzk9nf
1+
**jQuery Form Validator** is a feature rich jQuery plugin that makes it easy to validate user input while keeping your
2+
HTML markup clean from javascript code. Even though this plugin has **a wide range of validation functions**
3+
it's designed to require as little bandwidth as possible. This is achieved by grouping together validation functions
4+
in "modules", making it possible for the programmer to load **only those functions that's needed** to validate a
5+
particular form.
126

137
*Usage example*
148

159
```html
1610
<html>
1711
<head>
1812
<script src="js/jquery.min.js"></script>
19-
<script src="js/formvalidator/jquery.formvalidator.min.js"></script>
13+
<script src="js/form-validator/jquery.form-validator.min.js"></script>
2014
<script>
2115
$.formUtils.loadModules('date,security');
2216
</script>
@@ -50,13 +44,10 @@ to load **only those functions that's needed** to validate a particular form.
5044
* **validate_int**
5145
* **validate_date***yyyy-mm-dd (format can be customized, more information below)*
5246
* **validate_length***Validate that input length is in given range (length3-20)*
53-
<<<<<<< .merge_file_MDtscE
5447
* **validate_confirmation**
5548
* **validate_spamcheck**
5649
* **validate_ukvatnumber**
5750
* **validate_swesec***validate swedish social security number*
58-
=======
59-
>>>>>>> .merge_file_lzk9nf
6051
* **required***no validation except that a value has to be given*
6152
* **validate_custom***Validate value against regexp (validate_custom regexp/^[a-z]{2} [0-9]{2}$/)
6253
* **validate_num_answers***Validate that a select element has the required number of selected options (validate_num_answers num5)*
@@ -92,10 +83,7 @@ to load **only those functions that's needed** to validate a particular form.
9283
### Misc (part of core)
9384
* Show help information automatically when input is focused
9485
* Validate given values immediately when input is blurred.
95-
<<<<<<< .merge_file_MDtscE
96-
* Make validation optional by adding attribute data-validation-optional="true" to the element. This means that the validation defined in data-validation only will take place in case a value is given.
9786
* Make validation dependent on another input of type checkbox being checked by adding attribute data-validation-if-checked="name of checkbox input"
98-
=======
9987
* Make validation optional by adding attribute data-validation-optional="true" to the element. This means
10088
that the validation defined in data-validation only will take place in case a value is given.
10189
* Make validation dependent on another input of type checkbox being checked by adding attribute
@@ -179,8 +167,6 @@ caches the javascript).
179167
The second argument is the path where the module files is located. This argument is optional, if not given
180168
the module files has to be located in the same directory as the core modules shipped together with this jquery plugin
181169
(js/formvalidator/)
182-
>>>>>>> .merge_file_lzk9nf
183-
184170

185171
## Validate inputs on blur
186172
It is possible to show that the value of an input is incorrect immediately when the input gets blurred.
@@ -204,13 +190,8 @@ It is possible to display help information for each input. The information will
204190
```html
205191
<form action="" onsubmit="return $(this).validate();" id="my_form">
206192
<p>
207-
<<<<<<< .merge_file_MDtscE
208193
<strong>Why not:</strong>
209194
<textarea name="why" data-validation-help="Please give us some more information" data-validation="required"></textarea>
210-
=======
211-
<strong>Why not?</strong>
212-
<textarea data-help="Please give us some more information" data-validation="required"></textarea>
213-
>>>>>>> .merge_file_lzk9nf
214195
</p>
215196
...
216197
</form>
@@ -274,7 +255,7 @@ $('#my_form')
274255
## Localization
275256
This plugin contains a set of error dialogs. In case you don't define an inline error message the plugin
276257
will fall back on one of the dialogs below. You can how ever add the attribute *data-validation-error-msg* to an
277-
element, and that message will be displayed instead. All error dialogs can be overwritten by passing an
258+
element, and that message will be displayed instead. All error dialogs can be overwritten by passing an
278259
object into the validation function.
279260

280261
```javascript
@@ -317,7 +298,7 @@ var enErrorDialogs = {
317298
...
318299
```
319300

320-
Inline error messages is also possible. If you add attribute data-validation-error-msg to an element the value of that attribute will be displayed instead of the error dialog that the validation function referrs to.
301+
Inline error messages is also possible. If you add attribute data-validation-error-msg to an element the value of that attribute will be displayed instead of the error dialog that the validation function refers to.
321302

322303
## Simple captcha example
323304
```php
@@ -361,27 +342,25 @@ $_SESSION['captcha'] = array( mt_rand(0,9), mt_rand(1, 9) );
361342
<p>Confirm password: <input type="password" name="pass_confirmation" /></p>
362343
```
363344

364-
<<<<<<< .merge_file_MDtscE
365-
## Credits
366-
[Victor Jonsson](https://github.com/victorjonsson)<br />
367-
=======
368345
## Changelog
369346

370-
### 2.0
347+
#### 2.0
371348
* validate_[min|max]_length is removed (now merged with validate_length)
372349
* validate_number, validate_int, validate_float is merged together, all three variants is now validated by validate_number
373350
* validate_phone moved to "sweden" module and renamed to validate_swephone
374-
* The attribute to be used when defining the regular expression for validate_custom is now moved to its own attribute
351+
* The attribute to be used when defining the regular expression for validate_custom is now moved to its own attribute (data-validation-regexp)
375352
* validate_length now looks at attribute data-validation-length to find out how long or short the value must be
353+
* The validation rule no longer needs to be prefixed with "validate_"
354+
* Some validation functions is moved to modules (see function reference in top of this document)
355+
356+
## Maintainer
357+
358+
[Victor Jonsson](https://github.com/victorjonsson)
376359

377360
## Contributors
378-
>>>>>>> .merge_file_lzk9nf
379361
[Joel Sutherland](https://github.com/robamaton) (contributor)<br />
380362
[Steve Wasiura](https://github.com/stevewasiura) (contributor)<br />
381363
[Matt Clements](https://github.com/mattclements) (contributor)<br />
382364
[dfcplc](https://github.com/dfcplc) (contributor)<br />
383-
<<<<<<< .merge_file_MDtscE
384-
=======
385365
[Darren Mason](http://www.mypocket-technologies.com) (Password strength meter)<br />
386-
>>>>>>> .merge_file_lzk9nf
387366
[Scott Gonzales](http://projects.scottsplayground.com/iri/) (URL regexp)

0 commit comments

Comments
 (0)