I'm intercepting the submission of a form with jQuery and validating a few things before continuing submission. The problem is that there are multiple submit buttons with different actions on the page and when I try to call form.submit()
after validation the name
tag of the submit button is lost / not sent in the request-params.
My HTML looks like this:
<input type="submit" name="publish" value="Publish">
<input type="submit" name="draft" value="Save as draft">
and in the coffeescript code I'm intercepting form submission with:
$('#foo-form').submit (e) ->
e.preventDefault()
form = this
# DO WORK...
# A callback eventually calls form.submit()
I'd like to somehow store which button was clicked and pass it on to form.submit()
.