PDA

View Full Version : xhtml validation error


melCarmasin
06-15-2007, 11:34 PM
Hi, I keep getting an error in my code when validating my xhtml page with the w3c validator. http://validator.w3.org/

I can't figure how to fix the error, it's only a closing form tag. The very last form tag on the page.
Here's the error and my code.

Error Line 246 column 6: end tag for element "form" which is not open.

</form>

The Validator found an end tag for the above element, but that element is not currently open. This is often caused by a leftover end tag from an element that was removed during editing, or by an implicitly closed element (if you have an error related to an element being used where it is not allowed, this is almost certainly the case). In the latter case this error will disappear as soon as you fix the original problem.

*Removed code.

Fumigator
06-16-2007, 12:45 AM
Because you are closing the form implicitly here:

<form id="clockForm" action=""/>

That "/>" on the end closes the tag just the same as this does:

<form id="clockForm" action=""></form>

melCarmasin
06-16-2007, 02:53 AM
ah ha, thank you kind sir.

Arbitrator
06-16-2007, 01:35 PM
Because you are closing the form implicitly here:Actually, that’s an explicit self‐closure. The “implicitly closed element” error described in the error message is something like that in the code shown below.

<p>
<div></div>
</p>The div element is not permitted inside of the p element as per the DTD. Because the p element also has an optional end tag, the appearance of the div element implicitly closes the p element. The resulting code is shown below.

<p>
</p><div></div>
</p>Now, the error is quite clear; the implicit closure means that the end tag following the div element is orphaned.

I’m not sure how browsers handle this in practice. I believe that it’s one of the things tested in the Acid2 test though, so any browser passing that should also handle this correctly. That part of the error message doesn’t really apply here though since there is no such thing as implicit closure in XHTML (XML).