Skip to content

Commit 1ee3102

Browse files
committed
Replace $.format with $.validator.format
Fixes jquery-validation/jquery-validation#985
1 parent f14c554 commit 1ee3102

File tree

4 files changed

+4
-29
lines changed

4 files changed

+4
-29
lines changed

entries/jQuery.validator.format.xml

-25
Original file line numberDiff line numberDiff line change
@@ -26,30 +26,5 @@ var template = jQuery.validator.format("{0} is not a valid value");
2626
alert(template("abc"));
2727
]]></code>
2828
</example>
29-
<!-- {{APIExample|
30-
|desc=Demonstrates basic usage.
31-
|code=&lt;nowiki&gt;
32-
$(&quot;button&quot;).&lt;/nowiki&gt;{{Code|Events|click}}&lt;nowiki&gt;(function () {
33-
var str = &quot;Hello {0}, this is {1}&quot;;
34-
alert(&quot;'&quot; + str + &quot;'&quot;);
35-
36-
str = &lt;/nowiki&gt;{{Code|Plugins/Validation|jQuery.validator.format}}&lt;nowiki&gt;(str, &quot;World&quot;, &quot;Bob&quot;);
37-
alert(&quot;'&quot; + str + &quot;'&quot;);
38-
});
39-
&lt;/nowiki&gt;
40-
|inhead=&lt;nowiki&gt;&lt;script src=&quot;http://jzaefferer.github.com/jquery-validation/jquery.validate.js&quot;&gt;&lt;/script&gt;&lt;/nowiki&gt;
41-
|html=&lt;nowiki&gt;&lt;button&gt;Show format Example&lt;/button&gt;&lt;/nowiki&gt;
42-
}}
43-
44-
{{APIExample|
45-
|desc=Shows how to first create a template function by passing only the string argument and then calling it later.
46-
|code=&lt;nowiki&gt;$(&quot;button&quot;).&lt;/nowiki&gt;{{Code|Events|click}}&lt;nowiki&gt;(function () {
47-
var template = &lt;/nowiki&gt;{{Code|Plugins/Validation|jQuery.validator.format}}&lt;nowiki&gt;(&quot;Please enter more {0}, or order {0} by mail (see {1})&quot;);
48-
alert(template(&quot;Apples&quot;, &quot;our FAQ&quot;));
49-
});
50-
&lt;/nowiki&gt;
51-
|inhead=&lt;nowiki&gt;&lt;script src=&quot;http://jzaefferer.github.com/jquery-validation/jquery.validate.js&quot;&gt;&lt;/script&gt;&lt;/nowiki&gt;
52-
|html=&lt;nowiki&gt;&lt;button&gt;Show format Example&lt;/button&gt;&lt;/nowiki&gt;
53-
}} -->
5429
<category slug="validator"/>
5530
</entry>

entries/rules.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ $( "#myinput" ).rules( "add", {
5151
minlength: 2,
5252
messages: {
5353
required: "Required input",
54-
minlength: jQuery.format("Please, at least {0} characters are necessary")
54+
minlength: jQuery.validator.format("Please, at least {0} characters are necessary")
5555
}
5656
});
5757
]]></code>

entries/validate.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@
168168
}
169169
});
170170
</code></pre>
171-
<p><strong>Example</strong>: Validates the name-field as required and having at least two characters. Provides a callback message using jQuery.format to avoid having to specify the parameter in two places.</p>
171+
<p><strong>Example</strong>: Validates the name-field as required and having at least two characters. Provides a callback message using jQuery.validator.format to avoid having to specify the parameter in two places.</p>
172172
<pre><code>
173173
$(".selector").validate({
174174
rules: {
@@ -180,7 +180,7 @@
180180
messages: {
181181
name: {
182182
required: "We need your email address to contact you",
183-
minlength: jQuery.format("At least {0} characters required!")
183+
minlength: jQuery.validator.format("At least {0} characters required!")
184184
}
185185
}
186186
});

pages/reference.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ Let's consider an example where you have ten customer fields, each required and
5252
// alias minlength, too
5353
$.validator.addMethod("cMinlength", $.validator.methods.minlength,
5454
// leverage parameter replacement for minlength, {0} gets replaced with 2
55-
$.format("Customer name must have at least {0} characters"));
55+
$.validator.format("Customer name must have at least {0} characters"));
5656
// combine them both, including the parameter for minlength
5757
$.validator.addClassRules("customer", { cRequired: true, cMinlength: 2 });
5858
```

0 commit comments

Comments
 (0)