WordPress.org

Ready to get started?Download WordPress

Forums

Problem with form input type in XHTML 1.1 (3 posts)

  1. lingtyp
    Member
    Posted 8 years ago #

    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

  2. lingtyp
    Member
    Posted 8 years ago #

    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

  3. Seismos
    Member
    Posted 7 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic