Skip to content

Commit e325861

Browse files
committed
readme wip...
1 parent c981148 commit e325861

File tree

1 file changed

+29
-4
lines changed

1 file changed

+29
-4
lines changed

README.md

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
The goal of this project is to create a feature rich jQuery plugin used for validating form data and that
33
keeps the HTML code clean from javascript logic. Even though the plugin has **a wide range of validation functions**
4-
it's designed to consume the least amount bandwidth as possible (which makes it very suitable for **mobile websites**).
4+
it's designed to consume the least amount of bandwidth as possible (which makes it very suitable for **mobile websites**).
55
This is achieved by grouping together functions in "modules", making it possible for the programmer
66
to load **only those functions that's needed** to validate a particular form.
77

@@ -16,7 +16,7 @@ to load **only those functions that's needed** to validate a particular form.
1616
$.formUtils.loadModules('date,security');
1717
</script>
1818
</head>
19-
<form action="" onsubmit="return $(this).validate()">
19+
<form action="" onsubmit="return $(this).validate();">
2020
<p>
2121
Name (4 characters minimum):
2222
<input name="user" data-validation="validate_min_length length4" />
@@ -126,12 +126,37 @@ The validation function takes these five arguments:
126126

127127
## Creating a custom module
128128

129-
A module is simply a script file containing one or more calls to `$.formUtils.addValidator()`.
129+
A "module" is basically a script file containing one or more calls to [$.formUtils.addValidator()](#writing-a-custom-validator). The module file
130+
should either have the extension *.js* (as an ordinary javascript file) or *.dev.js*.
131+
132+
Using the extension **.dev.js** will make the module loading function to always append a timestamp to the end of the
133+
URL, so that the browser never caches the file. You should of course never use *.dev.js* on a production website.
134+
135+
### Loading your module ###
136+
137+
```
138+
<html>
139+
<head>
140+
<script src="js/formvalidator/jquery.formvalidator.min.js"></script>
141+
<script>
142+
$.formUtils.loadModules('mymodule.dev', 'js/validation-modules/');
143+
</script>
144+
</head>
145+
</html>
146+
...
147+
```
148+
149+
The first argument of $.formUtils.loadModules is a comma separated string with names of module files, without
150+
extension (add .dev if the file name is for example mymodule.dev.js, this will insure that the browser never
151+
caches the javascript).
130152

153+
The second argument is the path where the module files is located. This argument is optional, if not given
154+
the module files has to be located in the same directory as the core modules shipped together with this jquery plugin
155+
(js/formvalidator/)
131156

132157

133158
## Validate inputs on blur
134-
It is now possible to show that the value of an input is incorrect immediately when the input gets blurred.
159+
It is possible to show that the value of an input is incorrect immediately when the input gets blurred.
135160

136161
```html
137162
<form action="" onsubmit="return $(this).validate();" id="my_form">

0 commit comments

Comments
 (0)