Search code examples
xhtmlvalidationw3c

w3c validator tells an error


W3C says that I have an unclosed tag. By the way it HAS TO BE XHTML

Validation Output: 1 Error

Line 31, Column 9: end tag for "div" omitted, but OMITTAG NO was specified ✉ You may have neglected to close an element, or perhaps you meant to "self-close" an element, that is, ending it with "/>" instead of ">".

Line 19, Column 4: start tag was here

And here is my xhtml:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<head>
    <title>phpFormTemplate</title>
    <meta http-equiv="content-type" content="text/html;charset=utf-8" />
    <script type="text/javascript" src="phpFormTempate/checkform.js"></script>
    <link rel="stylesheet" type="text/css" href="phpFormTempate/css/default.css" />
</head>

<body>
    <div id="errorContainer">
    </div>
    <div id="phpformtemplate">
        <form action="/index.php" method="post"  accept-charset="utf-8" enctype="application/x-www-form-urlencoded">
            <div id="textrequired">*: Pflichtfelder</div>
<!-- begin input set n° 1 -->
            <div class="form-input-set-1">
                <span class="required-char">*</span>
                <div class="form-input-label-1">
                    <label for="Bemerkung">Bemerkung</label>
                </div>
                <div class="form-input-1">
                    <textarea id="Bemerkung" tabindex="1" accesskey="B" name="Bemerkung" class="required" rows="10" cols="50">Default</textarea>
                <div class="form-input-error-1">
                    <span id="error_Bemerkung"></span>
                </div>
            </div><!-- ISN'T IT THAT ONE? -->
<!-- iT CLOSES THE <div class="form-input-set-1"> -->
<!-- or am I wrong? pleas help!! -->
    <!-- end input set n° 1 -->
            </form>
        </div>
        <div id="errorContainer">
            <ul class="error-list">
                Es wurde keine E-Mail an den Besucher geschickt.
            </ul>
            <ul class="error-list">
                Diese E-Mail wurde an [email protected] geschickt.
            </ul>
        </div>
    </body>
    </html>

Solution

  • You need to have closing tag for this div, you've missed that

    <div class="form-input-set-1">
    

    Use some nice code editor like notepadd++, will save you from such head aches

    Try this

    <head>
        <title>phpFormTemplate</title>
        <meta http-equiv="content-type" content="text/html;charset=utf-8" />
        <script type="text/javascript" src="phpFormTempate/checkform.js"></script>
        <link rel="stylesheet" type="text/css" href="phpFormTempate/css/default.css" />
    </head>
    
    <body>
       <div id="errorContainer">
            <ul class="error-list">
                Ihre Daten wurden bereits verschickt.
            </ul>
        </div> 
        <div id="errorContainer">
        </div>
        <div id="phpformtemplate">
            <form action="/index.php" method="post"  accept-charset="utf-8" enctype="application/x-www-form-urlencoded">
                <div id="textrequired">*: Pflichtfelder</div>
    <!-- begin input set n° 1 -->
                <div class="form-input-set-1">
                    <span class="required-char">*</span>
                    <div class="form-input-label-1">
                        <label for="Bemerkung">Bemerkung</label>
                    </div>
                    <div class="form-input-1">
                        <textarea id="Bemerkung" tabindex="1" accesskey="B" name="Bemerkung" class="required" rows="10" cols="50"></textarea>
                        <div class="form-input-error-1">
                            <span id="error_Bemerkung"></span>
                        </div>
                    </div>
                </div> <!-- You were missing close tag here -->
    <!-- end input set n° 1 -->
            </form>
        </div>
    </body>
    </html>