- author Alan Blount [email protected]
- link https://github.com/zeroasterisk/jquery-autosaveform
NO COPYRIGHTS OR LICENSES. DO WHAT YOU LIKE.
$("#my-container form").autoSaveForm();
$("#MyForm").autoSaveForm({
autosave_frequency: 0, # autosave disabled
autosave_onclick: "#my-container a[href]:not([rel])", # custom links to be bound as autosavefirst
form_inputs: "select", # only considering selects in the form
attr_data: "data-ASFcustom-serialize", # customize internal attributes for forms' data
attr_status: "data-ASFcustom-status", # customize internal attributes for forms' status
form_response_regex: "Saved" # save response must contain: Saved
form_action: "/myform/submit.php" # over-ride the submit action for the form (edge case)
});
$("#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"));
});
$.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