I answered my own question because I was an idiot. :)
I've bound a function with jQuery submit()
to a form that prevents the default behaviour (with event.preventDefault()
and return false
) so that it can perform the client-side validation. The script doesn't actually do any form submission (it leaves that to another script).
Now I want to remove the event and revert to the default form behaviour. I need to actually post the data (without AJAX) to another page/website, but I still want to validate it using the script I wrote.
I have considered duplicating the form HTML and submitting it that way, but that would be a last resort.
I have tried using unbind('submit')
however that did nothing. I'm guessing it actually unbinds the default behaviour too.
What can I do? Is the default behaviour still bound to the form, just not in use?
Note: I can't modify the validation script nor can I unbind that specific function that prevents the default behaviour.
Source-code available on request, however most of the code is irrelevant, so I will only post snippets (shown below).
function _preventDefaults() {
//Prevent form from submitting (until we validate it)...
$('#myform').submit(function(event) {
event.preventDefault();
return false;
});
}