forked from huncent/Vanadium
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathREADME
54 lines (34 loc) · 2.37 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
Vanadium - Unobtrusive, Declarative, Server-side Technology Agnostic,
Ajax Enabled, Server-side Aware, Client-side Validation
-------------------------------------------------------
Version: 0.1
Author: Daniel Kwiecinski ([email protected])
Project Home: http://lambder.com
GIT repo: http://github.com/lambder/Vanadium
Vanadium is JavaScript validation toolkit that makes client-side validation easy.
Here's a rundown of the functionality:
* Validation rules are applied to HTML elements by adding special markup classes. E.g. adding ':required' to element's classes
makes the element being validated against provided value
* Instead of markup, one can use external definition provided as json structure.
* It is Ajax enabled in that sense one can declare particular field being validated by the result of the server response.
E.g. adding ':ajax;/path_on_server/user_exists.json' to element's classes will cause any change to value of that element being
sent to server as request. The response is expected to be json structure in the form of:
{success: (true/false), [message: (MESSAGE_TEXT)], [advice_id: (ID_OF_THE_HTML_ELEMENT_USED_FOR_INJECTING_THE_MESSAGE)]}
To have a html form with 4 fields: username, email, password and repeated password.
Where username is required and has to be at least 5 characters long and unique in the system, email is valid email adders
password is required and has to be at least 6 character long, repeated password has to be the same as password, then one use
the following HTML:
<input id="name" class=":required :min_length;5 :ajax;http://host.com/user_exists.json" type="text">
<input id="email" class=":required :email" type="text">
<input id="pass" class=":required :min_length;6" type="password">
<input id="repeat_pass" class=":same_as;pass" type="password">
* The the default (:;) markup prefix and separator can be reconfigured.
* :ajax;http://host.com/user_exists.json in the example is server-side validation which Vanadium uses for checking if given username
is already taken.
------------------------------------------------------------------------------------------------------------------------
Compatible with JQuery 1.3.2
Tested in: Firefox 3.5 (PC/Mac), Safari 2 (Mac), IE 6+, Opera 9 (PC/Mac)
Please mail any feedback to [email protected]
Acknowledgments / Credits
-------------------------
..... to be completed ......