forked from jquery-validation/jquery-validation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
todo
161 lines (146 loc) · 6.03 KB
/
todo
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
- consider a field-validator object that encapsulates a single element and all methods working on it
- document min/max/range methods for checkboxes/selects
/**
* Return false, if the element is
*
* - some kind of text input and its value is too short
*
* - a set of checkboxes has not enough boxes checked
*
* - a select and has not enough options selected
*
* Works with all kind of text inputs, checkboxes and select.
*
* @example <input name="firstname" class="{minLength:5}" />
* @desc Declares an optional input element with at least 5 characters (or none at all).
*
* @example <input name="firstname" class="{required:true,minLength:5}" />
* @desc Declares an input element that must have at least 5 characters.
*
* @example <fieldset>
* <legend>Spam</legend>
* <label for="spam_email">
* <input type="checkbox" id="spam_email" value="email" name="spam" validate="required:true,minLength:2" />
* Spam via E-Mail
* </label>
* <label for="spam_phone">
* <input type="checkbox" id="spam_phone" value="phone" name="spam" />
* Spam via Phone
* </label>
* <label for="spam_mail">
* <input type="checkbox" id="spam_mail" value="mail" name="spam" />
* Spam via Mail
* </label>
* <label for="spam" class="error">Please select at least two types of spam.</label>
* </fieldset>
* @desc Specifies a group of checkboxes. To validate, at least two checkboxes must be selected.
*
* @param Number min
* @name jQuery.validator.methods.minLength
* @type Boolean
* @cat Plugins/Validate/Methods
*/
/**
* Return false, if the element is
*
* - some kind of text input and its value is too short or too long
*
* - a set of checkboxes has not enough or too many boxes checked
*
* - a select and has not enough or too many options selected
*
* Works with all kind of text inputs, checkboxes and selects.
*
* @example <input name="firstname" class="{rangeLength:[3,5]}" />
* @desc Declares an optional input element with at least 3 and at most 5 characters (or none at all).
*
* @example <input name="firstname" class="{required:true,rangeLength:[3,5]}" />
* @desc Declares an input element that must have at least 3 and at most 5 characters.
*
* @example <select id="cars" class="{required:true,rangeLength:[2,3]}" multiple="multiple">
* <option value="m_sl">Mercedes SL</option>
* <option value="o_c">Opel Corsa</option>
* <option value="vw_p">VW Polo</option>
* <option value="t_s">Titanic Skoda</option>
* </select>
* @desc Specifies a select that must have at least two but no more than three options selected.
*
* @param Array<Number> min/max
* @name jQuery.validator.methods.rangeLength
* @type Boolean
* @cat Plugins/Validate/Methods
*/
- document numberOfInvalids and hideErrors
/**
* Returns the number of invalid elements in the form.
*
* @example $("#myform").validate({
* showErrors: function() {
* $("#summary").html("Your form contains " + this.numberOfInvalids() + " errors, see details below.");
* this.defaultShowErrors();
* }
* });
* @desc Specifies a custom showErrors callback that updates the number of invalid elements each
* time the form or a single element is validated.
*
* @name jQuery.validator.prototype.numberOfInvalids
* @type Number
*/
/**
* Hides all error messages in this form.
*
* @example var validator = $("#myform").validate();
* $(".cancel").click(function() {
* validator.hideErrors();
* });
* @desc Specifies a custom showErrors callback that updates the number of invalid elements each
* time the form or a single element is validated.
*
* @name jQuery.validator.prototype.hideErrors
*/
- css references
- http://test5.caribmedia.com/CSS/Secrets/members/michiel/floating-forms.html
- http://paularmstrongdesigns.com/projects/awesomeform/
- http://dnevnikeklektika.com/uni-form/
- consider validation on page load, disabling required-checks
- completely rework showErrors: manually settings errors is currently extremely flawed and utterly useless, eg. errors disappear if some other validation is triggered
- document focusInvalid()
- document validation lifecycle: setup (add event handlers), run validation (prepare form, validate elements, display errors/submit form)
-> show where the user can hook in via callbacks
- AND dependency: specify multiple expressions as an array
- add custom events for form and elements instead of more callbacks (additional options/callbacks)
- beforeValidation: Callback, called before doing any validation
- beforeSubmit: Callback, called before submitting the form (default submit or calling submitHandler, if specified)
- animations!!
- ajax validation:
- in combination with autocomplete (mustmatch company name, fill out address details, validate required)
- validate zip code in comparison to address, if match and state is missing, fill out state
- strong password check/integration: http://phiras.wordpress.com/2007/04/08/password-strength-meter-a-jquery-plugin/
- stop firefox password manager to popup before validation - check mozilla bug tracker?
- overload addMethod with a Option-variant:
$.validator.addMethod({
name: "custom",
message: "blablabla",
parameteres: false,
handler: function() { ... }
});
Examples:
- wordpress comment form, make it a drop-in method
- ajaxForm() integration
- ajaxSubmit with rules-option, more/less options to ajaxSubmit
- watermark integration http://digitalbush.com/projects/watermark-input-plugin
- datepicker integration
- timepicker integration ( http://labs.perifer.se/timedatepicker/ )
- integration with CakePHP ( https://trac.cakephp.org/ticket/2359 )
- integration with tabs: http://www.netix.sk/forms/test.html
- integration with rich-text-editors (FCKEditor, Codepress)
http://www.fyneworks.com/jquery/FCKEditor/
2.0
---
- attachValidation, removeValidation, validate (with UI), valid (without UI)
- (re)move current addMethod implementation
- move rules plugin option
- move metadata support
- make validate method chainable
-> provide an accessor for the validator if necessary at all
- move a few default methods to additions, eg. dateXXX, creditcard, definitely accept