Skip to content

Commit 8456748

Browse files
committed
Entries: Update addMethod docs, fix the name on the param argument
1 parent 2f976f3 commit 8456748

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

entries/jQuery.validator.addMethod.xml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<property name="element" type="Element">
1515
<desc>the element to be validated</desc>
1616
</property>
17-
<property name="value" type="String">
17+
<property name="params" type="Object">
1818
<desc>parameters specified for the method, e.g. for min: 5, the parameter is 5, for range: [1, 5] it's [1, 5]</desc>
1919
</property>
2020
</argument>
@@ -23,16 +23,10 @@
2323
</argument>
2424
</signature>
2525
<desc>Add a custom validation method. It must consist of a name (must be a legal javascript identifier), a javascript based function and a default string message.</desc>
26-
<longdesc>The arguments to the callback are:
27-
* the current value of the validated element
28-
* the element to be validated
29-
* parameters specified for the method, e.g. for min: 5 the parameter is 5, for range: [1, 5] it's [1, 5]
30-
31-
Please note: While the temptation is great to add a regex method that checks its parameter against the value, it is much cleaner to encapsulate those regular expressions inside their own method. If you need lots of slightly different expressions, try to extract a common parameter.
26+
<longdesc>
27+
For simple one-off validation, you can use the bundled <code>pattern</code> method (in additional methods, source in <code>src/additional/pattern.js</code>) to validate a field against a regular expression. In general, it is a good idea to encapsulate those regular expressions inside their own method. If you need lots of slightly different expressions, try to extract a common parameter.
3228

3329
See also a <a href="http://regexlib.com/DisplayPatterns.aspx">library of regular expressions</a>.
34-
35-
If you still can't resist, use the "pattern" method.
3630
</longdesc>
3731
<example>
3832
<desc>Add a validation method that checks if a value starts with a certain domain.</desc>

0 commit comments

Comments
 (0)