Added cancelSubmit flag

See e.g. http://stackoverflow.com/a/2879499/500976