Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

updated usage notes a bit

  • Loading branch information...
commit 24105603e41d70db3bd2ecb8baf52e151b4ecd98 1 parent 3fd2a35
@zeroasterisk authored
Showing with 28 additions and 4 deletions.
  1. +12 −2 README.textile
  2. +16 −2 jquery.autosaveform.js
View
14 README.textile
@@ -7,6 +7,10 @@ NO COPYRIGHTS OR LICENSES. DO WHAT YOU LIKE.
+h3. USAGE: setting up any number of forms, default options
+
+<pre><code>$("#my-container form").autoSaveForm();</code></pre>
+
h3. USAGE: setting up one form by ID, custom options
<pre><code>$("#MyForm").autoSaveForm({
@@ -19,9 +23,15 @@ h3. USAGE: setting up one form by ID, custom options
form_action: "/myform/submit.php" # over-ride the submit action for the form (edge case)
});</code></pre>
-h3. USAGE: setting up any number of forms, default options
+h3. EXTRA: bind event handlers for callbacks
-<pre><code>$("#my-container form").autoSaveForm();</code></pre>
+<pre><code>$("#MyForm").autoSaveForm({
+ form_response_regex: "Saved"
+}).bind("autosave_complete", function() {
+ pageTracker._trackEvent("ajax", "autoSaveForm", window.location.href, $(this).attr("action"));
+}).bind("autosave_error", function() {
+ pageTracker._trackEvent("ajax", "autoSaveFormERROR", window.location.href, $(this).attr("action"));
+});</code></pre>
h3. EXTRA CONFIGURATIONS
View
18 jquery.autosaveform.js
@@ -10,7 +10,12 @@
*
*/
/*
+### USAGE: setting up any number of forms, default options ###
+
+$("#my-container form").autoSaveForm();
+
### USAGE: setting up one form by ID, custom options ###
+
$("#MyForm").autoSaveForm({
autosave_frequency: 0, # autosave disabled
autosave_onclick: "#my-container a[href]:not([rel])", # custom links to be bound as autosavefirst
@@ -21,13 +26,22 @@ $("#MyForm").autoSaveForm({
form_action: "/myform/submit.php" # over-ride the submit action for the form (edge case)
});
-### USAGE: setting up any number of forms, default options ###
-$("#my-container form").autoSaveForm();
+### EXTRA: bind event handlers for callbacks ###
+
+$("#MyForm").autoSaveForm({
+ form_response_regex: "Saved"
+}).bind("autosave_complete", function() {
+ pageTracker._trackEvent("ajax", "autoSaveForm", window.location.href, $(this).attr("action"));
+}).bind("autosave_error", function() {
+ pageTracker._trackEvent("ajax", "autoSaveFormERROR", window.location.href, $(this).attr("action"));
+});
### EXTRA CONFIGURATIONS ###
+
$.fn.ASF_beforeunload = false; # disable onbeforeunload functionality
$.fn.ASF_beforeunload_message = "are you sure?"; # custom message before unload (if we need to prompt)
$.fn.ASF_debug = true; # turn on debug messages in console
+
*/
(function ($) {
// plugin options defaults (set per form)
Please sign in to comment.
Something went wrong with that request. Please try again.