How to fix: End tag for "form" which is not finished

Most Likely Cause and Fix

Your markup contains a <form> element with inputs that are not within a suitable containing element.

Use:

<form action="/search/" method="get">
  <div>
    <input name="q" value="">
    <input type="submit" value="Search">
  </div>
</form>
        

instead of:

<form action="/search/" method="get">
  <input name="q" value="">
  <input type="submit" value="Search">
</form>

What This Error Means

This error is telling you that the validator reached the end of a <form> element and found that this element did not contain what is expected.

This can happen if you inadvertently include an empty element which should contain child elements or if the markup within the element is not valid.

How To Fix It

For forms

Ensure that all form inputs are correctly within any required containing elements.

In your full HTML validation report, check for occurrences of the error document type does not allow element input here missing one of ….

Use:

<form action="/search/" method="get">
  <div>
    <input name="q" value="">
    <input type="submit" value="Search">
  </div>
</form>
        

instead of:

<form action="/search/" method="get">
  <input name="q" value="">
  <input type="submit" value="Search">
</form>

In general

There is no straightforward common fix for this type of error as it depends on the element that raised the error and the context in which this element appears in your markup.

Refer to the line and column number in the specific error you encountered to get some context on the cause of this error.

Check that you haven't included an element and omitted required child elements, such as including a list that lacks list items.

Check that the markup within the relevant element is valid. You may find that the relevant element contains additional elements that are not correctly nested or are not included within required containing elements.

Discuss, Comment and Improve

Did this help you? Can this page be improved? Let us know!

comments powered by Disqus