Skip to content

Commit 2154839

Browse files
committed
First method entry
1 parent 65ac71e commit 2154839

File tree

3 files changed

+59
-77
lines changed

3 files changed

+59
-77
lines changed

entries/remote-method.xml

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<?xml version="1.0"?>
2+
<entry name="remote" type="method" return="Boolean">
3+
<title>remote method</title>
4+
<desc>Requests a resource to check the element for validity.</desc>
5+
<longdesc>
6+
The serverside resource is called via jQuery.ajax (XMLHttpRequest) and gets a key/value pair, corresponding to the name of the validated element and its value as a GET parameter. The response is evaluated as JSON and must be <code>true</code> for valid elements, and can be any <code>false</code>, <code>undefined</code> or <code>null</code> for invalid elements, using the default message; or a string, eg. <code>"That name is already taken, try peter123 instead"</code> to display as the error message.
7+
8+
<p>For more examples, take a look the <a href="http://jquery.bassistance.de/validate/demo/marketo">marketo demo</a> and the <a href="http://jquery.bassistance.de/validate/demo/milk">milk demo</a>.</p>
9+
</longdesc>
10+
<signature>
11+
<argument name="options" type="Object">
12+
<desc>
13+
The URL of the resource to request for serverside validation (String) or options to fully customize the request, see <a href="http://api.jquery.com/jQuery.ajax">jQuery.ajax</a> for details.
14+
<p>These options deep-extend the defaults (<code>dataType:"json", data:{nameOfTheElement:valueOfTheElement}</code>). Any options you provide will override the defaults.</p>
15+
</desc>
16+
</argument>
17+
</signature>
18+
<example>
19+
<desc>Makes the email field required, an email and does a remote request to check if the given address is already taken.</desc>
20+
<code><![CDATA[
21+
$( "#myform" ).validate({
22+
rules: {
23+
email: {
24+
required: true,
25+
email: true,
26+
remote: "check-email.php"
27+
}
28+
}
29+
});
30+
]]></code>
31+
</example>
32+
<example>
33+
<desc>Makes the email field required, an email and does a remote request to check if the given address is already taken. In addition, the http method is set to "post" and the username is sent along side the email address.</desc>
34+
<code><![CDATA[
35+
$( "#myform" ).validate({
36+
rules: {
37+
email: {
38+
required: true,
39+
email: true,
40+
remote: {
41+
url: "check-email.php",
42+
type: "post",
43+
data: {
44+
username: function() {
45+
return $( "#username" ).val();
46+
}
47+
}
48+
}
49+
}
50+
}
51+
});
52+
]]></code>
53+
</example>
54+
<category slug="methods"/>
55+
</entry>

entries/rules.xml

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@
55
<longdesc>
66
Return the validations rules for the first selected element or
77

8-
Adds the specified rules and returns all rules for the first matched element. Requires that the parent form is validated, that is, $(&quot;form&quot;).validate() is called first or
8+
<p>Adds the specified rules and returns all rules for the first matched element. Requires that the parent form is validated, that is, $( "form" ).validate() is called first or</p>
99

10-
Removes the specified rules and returns all rules for the first matched element.
10+
<p>Removes the specified rules and returns all rules for the first matched element.</p>
1111

12-
There are several ways to specify validation rules.
12+
<p>There are several ways to specify validation rules.</p>
1313
<ul>
1414
<li>Validation methods without parameters can be specified as classes on the element (recommended)</li>
1515
<li>Validation methods with parameters can be specified as attributes (recommended)</li>
1616
<li>Both can be specified as metadata using the metadata plugin</li>
1717
<li>Both can be specified using the rules-option of the validate()-method</li>
1818
</ul>
19-
When setting, the rules can also contain a messages-object, specifying custom messages for existing or added rules.
19+
<p>When setting, the rules can also contain a messages-object, specifying custom messages for existing or added rules.</p>
2020
</longdesc>
2121
<signature>
2222
<desc>Read rules for the first element</desc>

jQuery+Wiki-plugins-validation-2013-05-13-18-01.xml

-73
Original file line numberDiff line numberDiff line change
@@ -248,79 +248,6 @@ jQuery.validator.setDefaults({
248248
<format>text/x-wiki</format>
249249
</revision>
250250
</page>
251-
<page>
252-
<title>Plugins/Validation/Methods/remote</title>
253-
<ns>0</ns>
254-
<id>2465</id>
255-
<revision>
256-
<id>15743</id>
257-
<parentid>11449</parentid>
258-
<timestamp>2009-06-15T15:43:06Z</timestamp>
259-
<contributor>
260-
<username>Enchos</username>
261-
<id>3</id>
262-
</contributor>
263-
<text xml:space="preserve" bytes="2093">{{APIHeader|Plugins/Validation/Methods|remote|function}}
264-
{{APIEntry|
265-
|type=function
266-
|name=remote
267-
|cat=Plugins/Validation/Methods
268-
|return=Boolean
269-
|desc=Requests a resource to check the element for validity.
270-
|longdesc=The serverside resource is called via $.ajax (XMLHttpRequest) and gets a key/value pair, corresponding to the name of the validated element and its value as a GET parameter. The response is evaluated as JSON and must be ''true'' for valid elements, and can be any ''false'', ''undefined'' or ''null'' for invalid elements, using the default message; or a string, eg. ''&quot;That name is already taken, try peter123 instead&quot;'' to display as the error message.
271-
272-
For more examples, take a look the [[Plugins/Validation#The_Marketo_sign-up_form|marketo demo]] and the [[Plugins/Validation#The_Remember_The_Milk_sign-up_form|milk demo]].
273-
|arg0=options
274-
|arg0type=String, Options
275-
|arg0desc=The URL of the resource to request for serverside validation (String) or options to fully customize the request, see {{Code|Ajax|jQuery.ajax}} for details.
276-
}}
277-
278-
&lt;noinclude&gt;
279-
{{APIExamples|
280-
281-
{{APIExample|
282-
|desc=Makes the email field required, an email and does a remote request to check if the given address is already taken.
283-
|code={{Code|Core|$}}(&quot;#myform&quot;).{{Code|Plugins/Validation|validate}}&lt;nowiki&gt;({
284-
rules: {
285-
email: {
286-
required: true,
287-
email: true,
288-
remote: &quot;check-email.php&quot;
289-
}
290-
}
291-
});&lt;/nowiki&gt;
292-
}}
293-
294-
{{APIExample|
295-
|desc=Makes the email field required, an email and does a remote request to check if the given address is already taken. In addition, the http method is set to &quot;post&quot; and the username is sent along side the email address.
296-
|code={{Code|Core|$}}(&quot;#myform&quot;).{{Code|Plugins/Validation|validate}}&lt;nowiki&gt;({
297-
rules: {
298-
email: {
299-
required: true,
300-
email: true,
301-
remote: {
302-
url: &quot;check-email.php&quot;,
303-
type: &quot;post&quot;,
304-
data: {
305-
username: function() {
306-
return $(&quot;#username&quot;).val();
307-
}
308-
}
309-
}
310-
}
311-
}
312-
});&lt;/nowiki&gt;
313-
}}
314-
315-
}}
316-
&lt;/noinclude&gt;
317-
318-
{{APIFooter|Plugins/Validation/Methods|remote|function}}</text>
319-
<sha1>o1f8gdvsuv4hiezlk312g7s78n9qu63</sha1>
320-
<model>wikitext</model>
321-
<format>text/x-wiki</format>
322-
</revision>
323-
</page>
324251
<page>
325252
<title>Plugins/Validation/Methods/accept</title>
326253
<ns>0</ns>

0 commit comments

Comments
 (0)