Skip to content

Commit e6cbcff

Browse files
committed
Merge pull request #14 from staabm/methods
Entries: Promote jQuery.validator.methods property as public api
2 parents add4f75 + 8efd52b commit e6cbcff

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

entries/email-method.xml

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<longdesc>
66
Return true if the value is a valid email address.
77
<p>Works with text inputs.</p>
8+
<p>In case you need a custom email pattern use the <a href="/jQuery.validator.methods/">$.validator.methods property</a>.</p>
89
</longdesc>
910
<example>
1011
<desc>Makes "field" required and an email address.</desc>

entries/jQuery.validator.methods.xml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0"?>
2+
<?xml-stylesheet type="text/xsl" href="../entries2html.xsl" ?>
3+
<entry type="method" name="jQuery.validator.methods" returns="Object">
4+
<title>jQuery.validator.methods</title>
5+
<desc>Object holding all validation methods known to the validator. This can be accessed to override individual methods, while keeping the default messages.</desc>
6+
<example>
7+
<desc>Sets a custom email pattern for the built-in email validation rule.</desc>
8+
<code><![CDATA[
9+
$.validator.methods.email = function( value, element ) {
10+
return this.optional( element ) || /[a-z]+@[a-z]+\.[a-z]+/.test( value );
11+
}
12+
]]></code>
13+
</example>
14+
<category slug="validator"/>
15+
</entry>

pages/documentation.md

+2
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@ Some more methods are provided as add-ons, and are currently included in additio
133133

134134
You can find the [source code for all additional methods in the GitHub repository](https://github.com/jzaefferer/jquery-validation/tree/master/src/additional).
135135

136+
It is possible to re-define the implementation of the built-in rules using the [`$.validator.methods` property](/jQuery.validator.methods/)
137+
136138
# [General Guidelines](/reference)
137139

138140
The General Guidelines section provides detailed discussion of the design and ideas behind the plugin, explaining why certain things are as they are. It covers the features in more detail than the API documentation, which just briefly explains the various methods and options available.

0 commit comments

Comments
 (0)