WordPress.org

Support

Support » Themes and Templates » Problem with form input type in XHTML 1.1

Problem with form input type in XHTML 1.1

  • Bernhard Hiegl
    Member

    @lingtyp

    In my sidebar there is this code:

    <h2>Search</h2>
    <div id=”searchdiv”>
    <form id=”searchform” method=”get” action=””>
    <input type=”text” name=”s” size=”15″ /></form>
    </div>

    The template uses XHTML 1.1 and the problem is that this code doesn´t validate. I get 2 messages:

    1. document type does not allow element “input” here; missing one of “ins”, “del”, “h1”, “h2”, “h3”, “h4”, “h5”, “h6”, “p”, “div”, “address”, “fieldset” start-tag.

    2. end tag for “form” which is not finished

    Both concerning this line:

    <input type=”text” name=”s” size=”15″ /></form>

    How can I fix this to make it validate.
    Could not find an answer by searching.

    Bernhard

Viewing 2 replies - 1 through 2 (of 2 total)
  • Bernhard Hiegl
    Member

    @lingtyp

    Found it! When wrapping the line above in div-tags, it validates!

    <div><input type=”text” name=”s” size=”15″ /></div>

    Could anybody give me a hint which rule in xhtml strict forces this wrapping?!

    Thanks in advance,

    Bernhard

    Thank you very much!

    I was struggling on this same problem as you, but only I couldn’t figure it out. Thank God for Google, right?

    Anyways, I’m not sure as to why the validator is this way, but it seems that all of your input, button, and whatnot tags need to be encompassed in one of the tags the validator mentioned. I used the tags for my form, which also made my label and linebreak valid.

    <form action=”blah.php” method=”post”>
    Label:<br/><input type=”text” name=”heh”/>
    </form>

    Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Problem with form input type in XHTML 1.1’ is closed to new replies.