Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
jquery plugin to simplify autosaving a form: periodic, window.onbeforeunload, elements.onclick
branch: master

changed to `async:true`

re #2 - taking the suggestion of @ulihecht and changing the ajax call to async... I can't remember why I initially made it sync, if there was a good reason, I didn't write why and no longer remember :/
latest commit ee4ed2be7d
alan blount authored
Failed to load latest commit information.
README.textile updated usage notes a bit
jquery.autosaveform.js changed to `async:true`

README.textile

jQuery AutoSaveForm

NO COPYRIGHTS OR LICENSES. DO WHAT YOU LIKE.

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
	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)
	});

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
Something went wrong with that request. Please try again.