Skip to content

Commit 882181c

Browse files
committed
added documentation
1 parent 7a307dc commit 882181c

File tree

1 file changed

+19
-9
lines changed

1 file changed

+19
-9
lines changed

README.md

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ particular form.
3939

4040
So what has changed since version 1.x?
4141

42-
* A whole bunch of validation functions have been added (see below)
42+
* A whole bunch of validation functions have been added (see below).
4343
* A modular design have been introduced, which means that some validation functions is default and others is
4444
part of a module. This in turn reduces server and bandwidth costs.
45-
* You no longer need to prefix the validation rules with "validate_"
46-
* Error message position now defaults to "element"
47-
* The optional features (validatOnBlur and showHelpOnFocus) is now enabled by default
48-
* The function $.setForm is introduced that makes it possible to initiate the form validation with less code
45+
* You no longer need to prefix the validation rules with "validate_".
46+
* Error message position now defaults to "element".
47+
* The optional features (validateOnBlur and showHelpOnFocus) is now enabled by default.
48+
* The function $.setupForm(config) is introduced to reduce the amount of code that needs to be written when initiating the form validation.
4949

5050

5151
### Default validators and features (no module needed)
@@ -58,7 +58,6 @@ So what has changed since version 1.x?
5858
* **length***min/max/range*
5959
* **required***no validation except that a value has to be given*
6060
* **custom***Validate value against regexp*
61-
* **num_answers***Validate that a select element has the required number of selected options (num_answers num5)*
6261
* Show help information automatically when input is focused
6362
* Validate given values immediately when input looses focus.
6463
* Make validation dependent on another input of type checkbox being checked by adding attribute data-validation-if-checked="name of checkbox input"
@@ -68,23 +67,31 @@ So what has changed since version 1.x?
6867
data-validation-if-checked="name of checkbox input"
6968
* Create input suggestions with ease, no jquery-ui needed
7069

70+
Read the documentation for the [default features at http://formvalidator.net/##default-validators](http://formvalidator.net/#default-validators)
71+
7172
### Module: security
7273
* **spamcheck**
7374
* **confirmation**
7475
* **strength***Validate the strength of a password (strength strength3)*
7576
* **backend***Validate value of input on backend*
7677

78+
Read the documentation for the [security module at http://formvalidator.net/#default-validators](http://formvalidator.net/#security-validators)
79+
7780
### Module: date
7881
* **time***hh:mm*
7982
* **birthdate***yyyy-mm-dd, not allowing dates in the future or dates that's older than 122 years (format can be customized, more information below)*
8083

84+
Read the documentation for the [date module at http://formvalidator.net/#default-validators](http://formvalidator.net/#date-validators)
85+
8186
### Module: location
8287
* **country**
8388
* **federatestate**
8489
* **longlat**
8590
* Suggest countries (english only)
8691
* Suggest states in the US
8792

93+
Read the documentation for the [location module at http://formvalidator.net/#default-validators](http://formvalidator.net/#location-validators)
94+
8895
### Module: sweden
8996
* **swemob***validate that the value is a swedish mobile telephone number*
9097
* **swesec***validate swedish social security number*
@@ -93,16 +100,20 @@ So what has changed since version 1.x?
93100
* Suggest county
94101
* Suggest municipality
95102

96-
### Module: ukvat
103+
Read the documentation for the [Swedish module at http://formvalidator.net/#default-validators](http://formvalidator.net/#sweden-validators)
104+
105+
### Module: uk
97106
* **ukvatnumber**
98107

108+
Read the documentation for the [UK module at http://formvalidator.net/#default-validators](http://formvalidator.net/#uk-validators)
109+
99110

100111
## Writing a custom validator
101112
You can use the function `$.formUtils.addValidator()` to add your own validation function. Here's an example of a validator
102113
that checks if the input contains an even number.
103114

104115
```html
105-
<form action="" method="post" onsubmit="return $(this).validate();">
116+
<form action="" method="POST">
106117
<p>
107118
<input type="text" data-validation="even" />
108119
</p>
@@ -287,7 +298,6 @@ var enErrorDialogs = {
287298
});
288299
</script>
289300
...
290-
291301
```
292302

293303
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.

0 commit comments

Comments
 (0)