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).
PHP, firefox, internet explorer, html, xhtml, form

Tags: , , , , ,

Related:


Comments

17 Responses to “Firefox Form Difficulty”

  1. Matt on November 4th, 2005 3:38 pm

    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.

  2. zbtirrell on November 4th, 2005 7:02 pm

    You may have a point…

  3. dts on May 4th, 2006 5:54 pm

    firefox having lots of other javascript issues.

  4. Allan on May 26th, 2006 2:25 pm

    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.

  5. zbtirrell on May 26th, 2006 3:43 pm

    What is your purpose for doing that?

  6. Gurvinder Singh Manjotra on July 4th, 2006 3:03 am

    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

  7. Badfox on July 17th, 2006 1:46 pm

    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.

  8. lego on September 13th, 2006 10:44 am

    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

  9. zbtirrell on September 13th, 2006 1:31 pm

    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.

  10. Troy Farrell on January 16th, 2007 12:38 am

    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.

  11. zbtirrell on January 16th, 2007 10:08 am

    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.

  12. Alex on April 25th, 2007 11:02 am

    Thank You

  13. Godkillah on April 30th, 2007 3:28 pm

    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.

  14. foxhunter on August 23rd, 2007 8:13 am

    :O Does FF even recognise JS? :O

  15. Manta on November 21st, 2007 8:22 pm

    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

  16. Mel on December 13th, 2007 12:00 am

    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.

  17. Marc Ferguson on December 17th, 2007 5:11 pm

    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!

Got something to say?





User contributed tags: t (667) - firefox form (600) - firefox forms (521) - firefox form submit (293) - firefox submit() (208) - javascript submit firefox (184) - submit firefox (177) - firefox javascript form submit (172) - form submit firefox (160) - forms in firefox (160) - form firefox (149) - .javascript submit() form firefox (149) - Firefox form.submit() (123) - forms firefox (121) - firefox submit form (114) - javascript form submit firefox (99) - form.submit firefox (79) - submit form firefox (78) - firefox form bug (77) - firefox form problem (76) - firefox submit button (75) - firefox form reset (71) - form post from firefox (67) - firefox javascript submit() (61) - firefox javascript submit form (59) - "document.submit is not a function" (58) - document.form firefox (48) - firefox form post (47) - form submit in firefox (42) - submit form javascript firefox (42) - submit javascript firefox (41) - firefox (39) - document. .submit is not a function (38) - firefox submit form javascript (38) - javascript form firefox (37) - form.submit in FireFox (37) - form reset firefox (35) - firefox and forms (34) - firefox reset form (33) - reset form firefox (33) - javascript firefox .submit (33) - javascript:submit() firefox (32) - firefox submit() problem (32) - submit form in firefox (30) - firefox document.form (30) - auto submit form firefox (30) - firefox form submission (29) - submit button not working in firefox (29) - form in firefox (29) - firefox form submit javascript (28) - firefox form action (28) - javascript form submit in firefox (28) - submit in firefox (28) - firefox document .submit (26) - firefox reset button (25) - firefox javascript form.submit (25) - javascript firefox submit form (25) - html not clickable in firefox (25) - document.submit FireFox (24) - firefox auto submit form (23) - firefox post form (23) - javascript reset form firefox (23) - form post firefox (22) - document submit() firefox (22) - javascript submit not working in firefox (22) - javascript firefox form submit (22) - firefox document.submit (21) - firefox reset (21) - firefox form tag (21) - firefox form not submitting (20) - firefox form value (20) - firefox form buttons (20) - firefox form submit problem (20) - autorun firefox (20) - firefox javascript form (20) - javascript "form reset" (19) - firefox submit javascript (19) - firefox form issues (19) - firefox form submit bug (19) - submit() + firefox + javascript (18) - firefox form bugs (18) - firefox form submit "not working" (18) - submit() not working in firefox (18) - form.submit() not working in firefox (18) - firefox form button (17) - firefox submit bug (17) - firefox forms bug (17) - f (17) - firefox form values (17) - javascript reset form ajax (17) - submit firefox form (17) - firefox button not clickable (16) - all (16) - firefox form problems (16) - firefox javascript forms (16) - javascript submit in firefox (16) - form reset in firefox (15) - javascript form reset firefox (15) - reset form in firefox (15) - form submission firefox (15) - FORMS FOR FIREFOX (15) - javascript firefox form (15) - javascript form value firefox (15) - form not submit in firefox (15) - form submit not working in firefox (15) - firefox forms not working (15) - firefox form javascript (14) - reset firefox (14) - error "document.submit is not a function" (14) - form.reset() firefox (14) - firefox form.reset (14) - form not submitting in firefox (14) - javascript form.submit firefox (13) - javascript firefox forms (13) - how to submit a form in firefox ? (13) - reset form javascript firefox (13) - javascript reset() firefox (13) - firefox form variables (13) - firefox button submits form (13) - javascript "reset is not a function" (13) - firefox not submitting form (12) - problems with forms in firefox (12) - firefox forms problem (12) - button & firefox & submit (12) - firefox "submit is not a function" (12) - firefox submit forms (12) - firefox submit form problem (12) - form.submit javascript firefox (12) - firefox javascript form reset (11) - form reset javascript firefox (11) - submit firefox problem (11) - firefox input reset (11) - firefox button submit (11) - forms and firefox (11) - firefox form submission problem (11) - "form problem" firefox (11) - document submit javascript firefox (11) - document.submit not working in firefox (11) - form not working in firefox (11) - Firefox form issue (10) - reset button firefox (10) - Firefox javascript submit not working (10) - javascript auto submit form firefox (10) - post form firefox (10) - firefox problem with forms (10) - document. submit() not working in firefox (10) - form tag in firefox (10) - firefox form example (10) - document submit in firefox (10) - firefox reset form javascript (10) -