WebKit Form Submit Bug & Workaround
There’s a subtle (read: hard to reproduce) bug in WebKit that can cause a form to fail to submit, either when clicking an input of type submit, or when calling the submit() method programmatically.
I ran into it recently, but have been unable to reduce the code I was working on, which I can’t post, to something I can post that still triggers the bug.
That said, I’ve found a probable cause and a workaround that could come in handy, should you run into it.
The cause appears to be HTML5 form validation code, which is getting run (and failing no matter what) even when the doctype is not an HTML5 doctype, and is especially annoying because it fails silently. When this bug is in play, there is no error generated—it simply doesn’t submit the form.
The workaround, and the reason I suspect this is the cause, is to set:
theform.noValidate = true;
This will prevent the HTML5 form validation from running even if WebKit mistakenly thinks it should.
You might be able to use the novalidate attribute in the form tag as well, but this was not an option in the code I needed to fix.