Matthias: Wieso ist dieses Markup nicht valide?

Hallo,

der Validator mag dieses Code-Schnipselchen nicht, aber ich verstehe nicht warum, hat jemand eine Idee warum?

<!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>ProWerk - </title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <link type="text/css" media="all" href="grafik/css/style_1.css" rel="stylesheet" />
</head>
<body>
        <div id="angebot_1">
             <form class="form_shop" action="index.html" method="post" >
                <input type="hidden" name="action" value="add_cart" />
                <input type="hidden" name="item" value="3" />
                <input class="warenkorb_button" type="submit" title="Ihrem Warenkorb hinzuf&uuml;gen" value="[zum Warenkorb]" />
             </form>
        </div>
</body>
</html>

Ausgabe des Validators:

Below are the results of checking this document for XML well-formedness and validity.

1. Error Line 11 column 67: document type does not allow element "input" here; missing one of "p", "h1", "h2", "h3", "h4", "h5", "h6", "div", "pre", "address", "fieldset", "ins", "del" start-tag.

...input type="hidden" name="action" value="add_cart"></input>

The mentioned element is not allowed to appear in the context in which you've placed it; the other mentioned elements are the only ones that are both allowed there and can contain the element mentioned. This might mean that you need a containing element, or possibly that you've forgotten to close a previous element.

One possible cause for this message is that you have attempted to put a block-level element (such as "<p>" or "<table>") inside an inline element (such as "<a>", "<span>", or "<font>").


   2. Error Line 12 column 58: document type does not allow element "input" here; missing one of "p", "h1", "h2", "h3", "h4", "h5", "h6", "div", "pre", "address", "fieldset", "ins", "del" start-tag.

<input type="hidden" name="item" value="3"></input>

The mentioned element is not allowed to appear in the context in which you've placed it; the other mentioned elements are the only ones that are both allowed there and can contain the element mentioned. This might mean that you need a containing element, or possibly that you've forgotten to close a previous element.

One possible cause for this message is that you have attempted to put a block-level element (such as "<p>" or "<table>") inside an inline element (such as "<a>", "<span>", or "<font>").


   3. Error Line 13 column 125: document type does not allow element "input" here; missing one of "p", "h1", "h2", "h3", "h4", "h5", "h6", "div", "pre", "address", "fieldset", "ins", "del" start-tag.

...zuf&uuml;gen" value="[zum Warenkorb]"></input>

The mentioned element is not allowed to appear in the context in which you've placed it; the other mentioned elements are the only ones that are both allowed there and can contain the element mentioned. This might mean that you need a containing element, or possibly that you've forgotten to close a previous element.

One possible cause for this message is that you have attempted to put a block-level element (such as "<p>" or "<table>") inside an inline element (such as "<a>", "<span>", or "<font>").

  1. Hello,

    1. Error Line 11 column 67: document type does not allow element "input" here; missing one of "p", "h1", "h2", "h3", "h4", "h5", "h6", "div", "pre", "address", "fieldset", "ins", "del" start-tag.

    ...input type="hidden" name="action" value="add_cart"></input>

    The mentioned element is not allowed to appear in the context in which you've placed it; the other mentioned elements are the only ones that are both allowed there and can contain the element mentioned. This might mean that you need a containing element, or possibly that you've forgotten to close a previous element.

    na ja, es steht doch da, was ihm nicht gefällt. Du darfst kein <input> direkt in einem <form> platzieren, weil letzteres nur die oben genannten Kinder haben darf.

    MfG
    Rouven

    --
    -------------------
    Computer programming is tremendous fun. Like music, it is a skill that derives from an unknown blend of innate talent and constant practice. Like drawing, it can be shaped to a variety of ends: commercial, artistic, and pure entertainment. Programmers have a well-deserved reputation for working long hours but are rarely credited with being driven by creative fevers. Programmers talk about software development on weekends, vacations, and over meals not because they lack imagination, but because their imagination reveals worlds that others cannot see. -- Larry OBrien and Bruce Eckel in Thinking in C#
    1. Oh, ja ich habe in ein DIV gepackt und plötzlich ist es valide, was soll der Unsinn denn?

      Komisch das mir das noch nie aufgefallen ist.

      Danke für die schnelle Antwort

      1. Hallo.

        Oh, ja ich habe in ein DIV gepackt und plötzlich ist es valide, was soll der Unsinn denn?

        Das ist kein Unsinn, sondern offenbar eine Vorgabe für XHTML 1.0 Strict. Ich würde anstatt eines divs bei einem Formular mit fieldset arbeiten.

        MfG, Kungschu.

  2. Hi!

    der Validator mag dieses Code-Schnipselchen nicht, aber ich verstehe nicht warum, hat jemand eine Idee warum?

    Deine Frage wurde mittlerweile ja beantwortet.
    Aber für's nächste Mal:
    Der Validator hat dir ganz deutlich gesagt, wo das Problem lag.
    Wenn du das nicht verstehst, dann solltest du vielleicht einen Validator einsetzen, der dir Meldungen in deutsch ausgibt:
    http://validator.de.selfhtml.org/

    Schöner Gruß,
    rob