Skip to content

Commit 23a3c4f

Browse files
d-phstaabm
authored andcommitted
Entries: Add docs for Validator.destroy() on the webpage. (#32)
Closes #1912.
1 parent 2f51f06 commit 23a3c4f

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

entries/Validator.destroy.xml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?xml version="1.0"?>
2+
<?xml-stylesheet type="text/xsl" href="../entries2html.xsl" ?>
3+
<entry type="method" name="Validator.destroy">
4+
<title>Validator.destroy()</title>
5+
<signature>
6+
</signature>
7+
<desc>Destroys this instance of validator freeing up resources and unregistering events.</desc>
8+
<longdesc>This is only useful, when you need to clean up after the validator in a Single Page Application.</longdesc>
9+
<example>
10+
<desc>Destroying an instance of validator.</desc>
11+
<code><![CDATA[
12+
/*
13+
* On SPA page start.
14+
*/
15+
var validator = $( "#myform" ).validate();
16+
17+
/*
18+
* Just before SPA page's navigation away.
19+
*/
20+
validator.destroy();
21+
22+
/*
23+
* After this point the #myForm form is back to its original boring state.
24+
*/
25+
]]></code>
26+
</example>
27+
<category slug="validator"/>
28+
</entry>

pages/documentation.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ The validate method returns a Validator object that has a few public methods tha
9595
* [`Validator.resetForm()` - Resets the controlled form.](/Validator.resetForm)
9696
* [`Validator.showErrors()` - Show the specified messages.](/Validator.showErrors)
9797
* [`Validator.numberOfInvalids()` - Returns the number of invalid fields.](/Validator.numberOfInvalids)
98+
* [`Validator.destroy()` - Destroys this instance of validator.](/Validator.destroy)
9899

99100
There are a few static methods on the validator object:
100101

0 commit comments

Comments
 (0)