Firefox automatically adds a closing form tag too soon - IE and Chrome are fine

Can someone tell me why Firefox will close the form earlier by adding </form> ? It closes the form long before the submit button, so the form will not be submitted.

All code for the form is a little long to post here. It works fine in Chrome and IE, but Firefox seems to close the form early and remove the later </form> .

html is output from PHP. Not sure if this will make a difference?

Editing in firebug does not work either. Any ideas appreciated.

thanks

+4
source share
3 answers

When a browser closes a form or div unexpectedly, this is usually because there is some kind of error in the code - like closing a div instead of opening.

I suggest you pass the w3c Validator code and fix the errors.

+7
source

Can someone tell me why Firefox will close the form earlier by adding? It closes the form long before the submit button, so the form will not be submitted.

This usually happens because you have a design that should be interpreted as an end-of-form tag or is seriously invalid so that the browser does not recover well due to an error.

All code for the form is a little long to post here.

No, this is not the case (although if you can create a smaller test case that still demonstrates the problem, then that would be preferable.

html is output from PHP. Not sure if this will make a difference?

This is not true. Browsers only care about what is in the HTTP response, and not how it got there.

+5
source

Have you tried using a validator to make sure your code is correct?

You can get Tidy to validate for you, or send the code http://validator.w3.org/

This will tell you pretty quickly if you have questionable markup that causes Firefox to behave.

+2
source

Source: https://habr.com/ru/post/1347564/


All Articles