This was one of those times where I don’t know whether to be annoyed with myself or annoyed with FireFox; for the moment, however, I choose the latter.
My contact form on jwindesign.com was getting a lot of spam recently. The only validation I had included was checking the format of the e-mail but not much else. So in an effort to curtail some (hopefully all) of the useless e-mails I added an easy math problem to validate something of at least mild intelligence was at the computer. Much to my chagrin the spam kept coming.
What was going on? Did they actually have a team of slaves typing these e-mails one at a time? Couldn’t be. So I started poking around my code to find out what I did wrong, only, everything looked correct. Then I realized the form submitted itself any time you pressed the submit button regardless of my Javascript. The part that confused me was the fact that my submit button wasn’t really a submit button, so why the hell is it submitting?!
The solution: FireFox interprets any button within a form that hasn’t been explicitly declared a “button” with the “type” attribute as a submit button.
I suppose statistically it makes sense, more people will forget to make a button a proper submit even though they intend for it to do just that than folks who don’t want it to submit.