Why won't this XHTML form validate?

Gary Willoughby picture Gary Willoughby · Oct 31, 2008 · Viewed 7.1k times · Source

Any ideas why this won't validate here:

http://validator.w3.org/#validate_by_input

It seems the form input tags are wrong but reading through the XHTML spec they should validate fine. Any ideas?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
 <head>
  <title>Test</title>
 </head>

 <body>
    <div class="Header">
        <table class="HeaderTable">
            <tr>
                <td>
                    <div class="Heading">Test <span class="Standard">Test</span>
                    </div>
                </td>
                <td>
                    <div class="Controls">
                        <form id="ControlForm" method="get" action="Edit.php">
                            <input type="submit" name="action" id="Edit" value="Edit" />
                            <input type="submit" name="action" id="New" value="New" />
                        </form>
                    </div>
                </td>
            </tr>
        </table>
    </div>
 </body>
</html>

Answer

Rahul picture Rahul · Oct 31, 2008

Try putting a fieldset tag around the inputs. I think the idea of forms in XHTML is that they can't have direct descendants that aren't div, fieldset, etc.