Firefox Form Difficulty
November 4, 2005
I had this form that I kept getting reports about it not working. I knew the form had not changed in over a year, so was confused by the report. I fired up Internet Explorer, tested it, it worked perfect. However, the form didn’t work at all in Firefox. Looking at it, it seemed pretty simple, so what was the issue?
So, I took the form and started some known array debugging techniques, mainly a simple print_r($_POST) which showed all the array elements with proper values in IE, but with Firefox they all had the default form values. Strange.
So, I copied the form out of the overall application, dropping included functions, libraries, and global variables. Just taking the standalone form and posting it to a PHP script that only print_r()’d the $POST array. Still did it.
It then dawned on me that I should try just a simple hand coded form unrelated to this example to make sure I didn’t have a flawed Firefox install, and in turn be certain it could process forms. Of course it could, this was good. Something was wrong with my form specifically.
I then boiled the form down to be extremely simple, removing various elements one at a time until the form functioned properly, which it eventually did. I had then narrowed it down to be related to the <input type=”reset” name=”reset” value=”reset” /> button. At this point I jumped to the conclusion that maybe Firefox had messed up the reset button implementation, so made a simple form using it, and it worked fine…
Now I knew the reset was related, but not the sole cause, so what was different? For some reason, the reset and submit buttons had a <label> tag around them. I know, this doesn’t make any sense, but it also shouldn’t cause this level of difficulty.
Anyway, here’s a simplified version of a troubling form:
<form method=”post” action=”show_post.php”>
<input name=”example” type=”text” size=”40″ value=”{something default}” />
<label>
<input type=”reset” name=”reset” value=”Reset” />
<input type=”submit” name=”Submit” value=”Submit” />
</label>
</form>
Test it out here and you’ll see what I mean (hopefully).
Tags: firefox, form, html, internet explorer, php, xhtml
Comments
17 Responses to “Firefox Form Difficulty”
Got something to say?

Yeah, it doesn’t work in Firefox. However, its probably an intentional bug to cause f-tards that build forms like that to have a hard time forcing them to leave the web development community forever. Anyone that places label tags around reset and submit buttons should be taken out and shot.
Some people are squirrel handed. Thank you. That is all.
You may have a point…
firefox having lots of other javascript issues.
I’m having a similar problem that I had working in test scenarios, then I went to a full implementation (with very little code change) and it stopped working correctly in Firefox. The form is an auto-looping form that works with AJAX to request data from a database. In Firefox the autorun() function runs through once and the document.form[0].submit() function works the first time. When I recall the autorun function for the second iteration the document.form[0].submit() function fails, but Firefox does not specify an error. I know the code is correct and everything works in IE, but Firefox gives issues.
The strange part is I have a similar function to submit data to a database which works perfectly with the same structure. I believe it’s a major Firefox issue with Javascript and forms that should be resolved sometime soon.
What is your purpose for doing that?
Of course form submission wouldn’t work out in FireFox. The solution behind is write all html tags like ….. which recognizes & will submit the document.
Gurvinder Singh Manjotra
Project Manager
Contact : gs_manjotra@yahoo.com
Firefox is so buggy, I wish I didn’t have to write pages that support it. It takes up so much extra development time it’s ridiculous. World Firefox Day is when I tell people to stay the hell away from it.
according to the w3c specification you are never allowed to have an end tag on the tag which you have with the in your example.
check out http://www.w3.org/TR/html4/interact/forms.html
You are absolutely correct. The above code is 100% bad. But… as anyone knows who writes much HTML, mistakes happen. I merely posted so others may be able to find their problem through my ignorance.
Actually, the behavior you describe is not a bug in Firefox. It is a bug in the HTML. Only one input element is allowed inside a label element. You will find similar behavior if you try to put two radio buttons inside a label element. The second cannot be clicked in Firefox.
I’m thankful that the browser is actually forcing us to write proper code.
It still seems like bizarre reaction to the improper code. The button appears, but is not clickable? The browser bothers to render it, but doesn’t attach action to it appropriately? The counterintuitive nature of the way this renders is the bug here.
Obviously the HTML is incorrect, but a significant power of HTML and browsers is their ability to carry on regardless of the ineptness of the code. The way this acts leads one on wild goose chases with debugging.
Thank You
What a nonsense am i reading here?!
Firefox is the best browser there is and spoken about javascript issues Internet explorer has lots more of them! for example with writing rows in tables, in firefox it could be as simple as
document.getElementById(”test”).innerHTML+=”test”
in IE it would require a page full of lines with DOM.
im not saying FF doesnt have any issues at all but it has less than IE.
:O Does FF even recognise JS? :O
I really don’t care who wins this silly browser war. All I want to see is a STANDARD, ONE STANDARD.
I’ve been writing code for over twenty years now and it seems everyone is so wrapped up in being exclusive that they end up creating standards over and over again. In the end the only trueth is there are no standards, and until a true universal standard is adheared to all of us programmers will continue to curse ALL the platforms.
IE: how many different compressors do you own? (zip, rar, ace, lha, arj, gzip, tar, gtar, dms, and about 10 others I can’t call off the top of my head).
Standards? WHat Standards, they are a myth LMAO
sorry, just my two sense worth
good work manta…how much simpler would life be if the same code worked on all browsers?! Whoever has thought while designing a browser ‘now i know there are standards for this function, but hey…lets make up a new one specifically for this browser’ should make a career change to garbage collecting.
Lots of IE/FF bashing going on (I’m on the winning side of course -> FF), but what about the solution to this problem? It seems that using a LABEL tag with multiple INPUT tags is a no no. I have a simple form used to take the user from one page to the next, not passing any values - it just uses onClick=’document.location={URL}’. The form works fine for IE, but FF doesn’t make the button clickable. Am I missing something? Here’s the code:
I do apologize, I know this is not a forum, but I’m desperate for answers and desperate times calls for desperate measures, or something like that!