I have a couple of forms that are misbehaving in FireFox, but work fine in IE.
In all the affected forms:
* The person enters data into forms, using any combination of text fields, textareas, radio buttons, and SELECT fields.
* The person clicks a submit button.
* A javascript function validates all of the fields entered, and stops the submission if there is an error.
* Once the validation is complete, and the form is ready for submission, the script submits the form.
Sample (obviously not working code):
<html>
<head>
<script>
function checkAndSubmitMe()
{
// do something, like form field validation before submitting
if (ready to submit) {
return true; // submits the form
} else {
return false; // do nothing, do not submit the form
}
}
</script>
</head>
<body>
<form id="myForm" name="myForm" action="form.cgi" method="post" onsubmit="return checkAndSubmitMe()">
Some form fields here<br/>
<input type="submit" value="Check First">
</form>
</body>
</html>
n FireFox (tested in v2.0.0.1 & v2.0.0.3):
* if the form validates correctly (tested by the "if (ready to submit)" above), it gets submitted twice: once with all of the data, and once with all fields blank (or default).
And, some more information:
My CGI "action" script sends an e-mail to me with the contents of the form. When the person uses IE, I get the one correct e-mail submission. When the user browses with FireFox, I get one correct submission and one blank submission.
I am using POST because some of the data fields can contain long data, and the URL gets messy with GET.
Using the Perl variable $ENV{'REQUEST_METHOD'}, I checked to see how the form was getting submitted. To do this, I simply appended the value of $ENV{'REQUEST_METHOD'} in the text of the e-mail submission.
On the first (correct) submission, the request method is POST, as I wrote in the above form.
On the second (blank) submission, the request method is GET. This is not written anywhere in my code.
Why is FireFox submitting the form once with POST (as my code requests), and then resubmitting it with GET, with no data?