document type does not allow element "input" here

Discussion in 'HTML' started by showandbeshown@gmail.com, Dec 9, 2007.

  1. Guest

    Hi,

    I try to validate an xhtml document. I got the following message:
    Line 52, Column 109: 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.

    I cannot understand the reason of that because the line 52 DOES NOT
    contain the element "input". Well, I have this element 2 lines bellow,
    but it IS included into the block-level element <div>.

    Can anybody help me?

    The source can be found here:
    http://www.showandbeshown.com/create_link.php
     
    , Dec 9, 2007
    #1
    1. Advertising

  2. wrote:
    > Hi,
    >
    > I try to validate an xhtml document. I got the following message:
    > Line 52, Column 109: 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.
    >
    > I cannot understand the reason of that because the line 52 DOES NOT
    > contain the element "input". Well, I have this element 2 lines bellow,
    > but it IS included into the block-level element <div>.
    >
    > Can anybody help me?
    >
    > The source can be found here:
    > http://www.showandbeshown.com/create_link.php
    >


    Put your hidden input inside the div and your problem will go away.

    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
     
    Jonathan N. Little, Dec 9, 2007
    #2
    1. Advertising

  3. zach Guest

    Jonathan N. Little wrote:
    > wrote:
    >> Hi,
    >>
    >> I try to validate an xhtml document. I got the following message:
    >> Line 52, Column 109: 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.
    >>
    >> I cannot understand the reason of that because the line 52 DOES NOT
    >> contain the element "input". Well, I have this element 2 lines bellow,
    >> but it IS included into the block-level element <div>.
    >>
    >> Can anybody help me?
    >>
    >> The source can be found here:
    >> http://www.showandbeshown.com/create_link.php
    >>

    >
    > Put your hidden input inside the div and your problem will go away.
    >


    The problem has nothing to do with a div, the problem is you have:

    <input type="text" name="searchbox" size="19" maxlength="30" ></input>

    That isn't the proper way to close an input element. You need to remove
    the </input and but a backslash at the end of the main input element
    like this:

    <input type="text" name="searchbox" size="19" maxlength="30" />
     
    zach, Dec 9, 2007
    #3
  4. I V Guest

    On Sun, 09 Dec 2007 00:08:37 -0800, zach wrote:
    > Jonathan N. Little wrote:
    >> Put your hidden input inside the div and your problem will go away.
    >>

    > The problem has nothing to do with a div, the problem is you have:
    >
    > <input type="text" name="searchbox" size="19" maxlength="30" ></input>
    >
    > That isn't the proper way to close an input element. You need to remove


    No, that's not right. The OP's code is exactly equivalent to the code you
    suggest - both are equally valid ways of writing an empty element. Besides
    which, the problem isn't with the text input, it's with the hidden input
    two lines above.

    To the OP: The hidden input doesn't show up when I view source from the
    browser, but does show up in the validator's "view source" or if I use
    wget the access your URL. Have a look at:

    http://validator.w3.org/check?uri=h...atically)&doctype=Inline&ss=1&group=0#line-52

    I suspect it only shows up when you are accessing the URL without cookies,
    and is being added by PHP (because the input is called PHPSESSID). I'm not
    sure, without seeing the PHP code how you would persuade PHP to put the
    input inside the DIV. You might want to post your source code to a PHP
    group.
     
    I V, Dec 9, 2007
    #4
  5. I V wrote:

    > I suspect it only shows up when you are accessing the URL without
    > cookies, and is being added by PHP (because the input is called
    > PHPSESSID).


    Yep, this is PHP's automatic session variable thingy.

    Normally session variable is passed using cookies, but PHP has an option
    that allows it to be passed by automatically rewriting forms and links.

    If you do not care about supporting User-Agents that don't allow cookies,
    then you can disable this rewriting be enabling the
    session.use_only_cookies option in your php.ini file.

    Or, if you were to use <fieldset> elements instead of <div>, then PHP is
    smart enough to put its hidden input inside the <fieldset> instead of
    inside the form.

    --
    Toby A Inkster BSc (Hons) ARCS
    [Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
    [OS: Linux 2.6.17.14-mm-desktop-9mdvsmp, up 1 day, 21:52.]

    Sharing Music with Apple iTunes
    http://tobyinkster.co.uk/blog/2007/11/28/itunes-sharing/
     
    Toby A Inkster, Dec 9, 2007
    #5
  6. Scripsit I V:

    > The OP's code is exactly equivalent to the code
    > you suggest - both are equally valid ways of writing an empty
    > element.


    This is not essential to the problem at hand, but it is relevant
    otherwise. The statement you make above is correct but grossly
    misleading.

    <input></input> and <input/> are equally _valid_ in XHTML but only one
    of them is _correct_. Anyone who doesn't understand this should not use
    XHTML, especially since he has probably missed most of the (in)famous
    Appendix C.

    (If you don't know what "Appendix C" refers in contexts like this, you
    surely shouldn't be using XHTML.)

    --
    Jukka K. Korpela ("Yucca")
    http://www.cs.tut.fi/~jkorpela/
     
    Jukka K. Korpela, Dec 9, 2007
    #6
  7. zach Guest

    I V wrote:
    > On Sun, 09 Dec 2007 00:08:37 -0800, zach wrote:
    >> Jonathan N. Little wrote:
    >>> Put your hidden input inside the div and your problem will go away.
    >>>

    >> The problem has nothing to do with a div, the problem is you have:
    >>
    >> <input type="text" name="searchbox" size="19" maxlength="30" ></input>
    >>
    >> That isn't the proper way to close an input element. You need to remove

    >
    > No, that's not right. The OP's code is exactly equivalent to the code you
    > suggest - both are equally valid ways of writing an empty element. Besides
    > which, the problem isn't with the text input, it's with the hidden input
    > two lines above.
    >
    > To the OP: The hidden input doesn't show up when I view source from the
    > browser, but does show up in the validator's "view source" or if I use
    > wget the access your URL. Have a look at:
    >
    > http://validator.w3.org/check?uri=h...atically)&doctype=Inline&ss=1&group=0#line-52
    >
    > I suspect it only shows up when you are accessing the URL without cookies,
    > and is being added by PHP (because the input is called PHPSESSID). I'm not
    > sure, without seeing the PHP code how you would persuade PHP to put the
    > input inside the DIV. You might want to post your source code to a PHP
    > group.


    By changing the code I suggested it will validate. There is nothing
    wrong with the hidden input. Go back and re-read my suggestion and then
    read the w3c documentation on XHTML 1.0 STRICT

    http://www.w3.org/TR/xhtml1/Overview.html
     
    zach, Dec 9, 2007
    #7
  8. zach Guest

    zach wrote:
    > I V wrote:
    >> On Sun, 09 Dec 2007 00:08:37 -0800, zach wrote:
    >>> Jonathan N. Little wrote:
    >>>> Put your hidden input inside the div and your problem will go away.
    >>>>
    >>> The problem has nothing to do with a div, the problem is you have:
    >>>
    >>> <input type="text" name="searchbox" size="19" maxlength="30" ></input>
    >>>
    >>> That isn't the proper way to close an input element. You need to remove

    >>
    >> No, that's not right. The OP's code is exactly equivalent to the code
    >> you suggest - both are equally valid ways of writing an empty element.
    >> Besides which, the problem isn't with the text input, it's with the
    >> hidden input two lines above.
    >>
    >> To the OP: The hidden input doesn't show up when I view source from
    >> the browser, but does show up in the validator's "view source" or if I
    >> use wget the access your URL. Have a look at:
    >>
    >> http://validator.w3.org/check?uri=h...atically)&doctype=Inline&ss=1&group=0#line-52
    >>
    >>
    >> I suspect it only shows up when you are accessing the URL without
    >> cookies, and is being added by PHP (because the input is called
    >> PHPSESSID). I'm not sure, without seeing the PHP code how you would
    >> persuade PHP to put the input inside the DIV. You might want to post
    >> your source code to a PHP group.

    >
    > By changing the code I suggested it will validate. There is nothing
    > wrong with the hidden input. Go back and re-read my suggestion and then
    > read the w3c documentation on XHTML 1.0 STRICT
    >
    > http://www.w3.org/TR/xhtml1/Overview.html


    I'm not sure but I think something has changed in the code since I first
    looked at it.
     
    zach, Dec 9, 2007
    #8
  9. zach Guest

    I V wrote:
    > On Sun, 09 Dec 2007 00:08:37 -0800, zach wrote:
    >> Jonathan N. Little wrote:
    >>> Put your hidden input inside the div and your problem will go away.
    >>>

    >> The problem has nothing to do with a div, the problem is you have:
    >>
    >> <input type="text" name="searchbox" size="19" maxlength="30" ></input>
    >>
    >> That isn't the proper way to close an input element. You need to remove

    >
    > No, that's not right. The OP's code is exactly equivalent to the code you
    > suggest - both are equally valid ways of writing an empty element. Besides
    > which, the problem isn't with the text input, it's with the hidden input
    > two lines above.
    >
    > To the OP: The hidden input doesn't show up when I view source from the
    > browser, but does show up in the validator's "view source" or if I use
    > wget the access your URL. Have a look at:
    >
    > http://validator.w3.org/check?uri=h...atically)&doctype=Inline&ss=1&group=0#line-52
    >
    > I suspect it only shows up when you are accessing the URL without cookies,
    > and is being added by PHP (because the input is called PHPSESSID). I'm not
    > sure, without seeing the PHP code how you would persuade PHP to put the
    > input inside the DIV. You might want to post your source code to a PHP
    > group.

    I apologize, I was incorrect, my reader was cutting off some of your
    reply so I did not see everything you suggested.
     
    zach, Dec 9, 2007
    #9
  10. Guest

    I have again the same error-message (with another code). In this code
    I used <input /> syntax, I have hidden input in the forms, and I have
    included form elements into <div> tags. But it does not help! Does
    anybody have any idea what is my problem?
     
    , Dec 11, 2007
    #10
  11. Guest

    , Dec 11, 2007
    #11
  12. rf Guest

    <> wrote in message
    news:...
    >I have again the same error-message (with another code). In this code
    > I used <input /> syntax, I have hidden input in the forms, and I have
    > included form elements into <div> tags. But it does not help! Does
    > anybody have any idea what is my problem?


    Didn't you understand the previous answer to this given to you by Jonathan?

    "Put your hidden input inside the div and your problem will go away."

    You have <form...><input...><div> ...

    What you need is <form...><div><input...>

    Forms may not contain inline elements as direct children. Input is an inline
    element.

    --
    Richard.
     
    rf, Dec 11, 2007
    #12
  13. rf Guest

    <> wrote in message
    news:...
    > Here is my code:
    > http://www.showandbeshown.com/tmp2.php


    Ignore my other post. I was looking at the URL you had posted previously,
    silly me :)

    Now, which of the 23 errors are you referring to? I see no "does not allow"
    error?

    Why are you using XHTML anyway. The most used browser out there does not
    understand XHTML which means you must serve it as text/html which means
    *every* browser is error correcting it to HTML. Why not just use HTML
    anyway?

    --
    Richard.
     
    rf, Dec 11, 2007
    #13
  14. Guest

    On Dec 10, 8:44 pm, "rf" <> wrote:
    > <> wrote in message
    >
    > news:...
    >
    > >I have again the same error-message (with another code). In this code
    > > I used <input /> syntax, I have hidden input in the forms, and I have
    > > included form elements into <div> tags. But it does not help! Does
    > > anybody have any idea what is my problem?

    >
    > Didn't you understand the previous answer to this given to you by Jonathan?
    >
    > "Put your hidden input inside the div and your problem will go away."
    >
    > You have <form...><input...><div> ...
    >
    > What you need is <form...><div><input...>
    >
    > Forms may not contain inline elements as direct children. Input is an inline
    > element.
    >
    > --
    > Richard.


    Hi Richard,

    But I do have <form...><div><input...> sequence. In my code the <div>
    tags go immediately after the <form> tags.
     
    , Dec 11, 2007
    #14
  15. Guest

    On Dec 10, 9:01 pm, "rf" <> wrote:
    > <> wrote in message
    >
    > news:...
    >
    > > Here is my code:
    > >http://www.showandbeshown.com/tmp2.php

    >
    > Ignore my other post. I was looking at the URL you had posted previously,
    > silly me :)
    >
    > Now, which of the 23 errors are you referring to? I see no "does not allow"
    > error?

    Strange, I have 26 errors and the first of them is:
    Line 52, Column 160: 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.
    ....="4bf822382c741097d6b28e594ee4cdfa" /><div>

    >
    > Why are you using XHTML anyway. The most used browser out there does not
    > understand XHTML which means you must serve it as text/html which means
    > *every* browser is error correcting it to HTML. Why not just use HTML
    > anyway?

    I tried to write this page in html 4.01 strict and I had some problem
    which forced me to go back to xhtml... But I forgot what was my
    problem. Sorry. It is really stupid. :) I think, I will try to
    rewrite the code in html again and if I meat this problem again I will
    let you know.

    >
    > --
    > Richard.
     
    , Dec 11, 2007
    #15
  16. wrote:
    > On Dec 10, 9:01 pm, "rf" <> wrote:
    >> <> wrote in message
    >>
    >> news:...
    >>
    >>> Here is my code:
    >>> http://www.showandbeshown.com/tmp2.php

    >> Ignore my other post. I was looking at the URL you had posted previously,
    >> silly me :)
    >>
    >> Now, which of the 23 errors are you referring to? I see no "does not allow"
    >> error?

    > Strange, I have 26 errors and the first of them is:
    > Line 52, Column 160: 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.
    > ...="4bf822382c741097d6b28e594ee4cdfa" /><div>


    <form enctype="multipart/form-data" action="tmp3.php"
    method="post"><input type="hidden" name="PHPSESSID"
    value="3a04eed62bd8689f1377fdc9164dbd4a" /><div>

    NOTE: PHPSESSID hidden *before* <div>? This is inserted because of the
    way you have your PHP sessions set up, Toby explained it to you earlier
    in the thread.

    http://message-id.net/<5n.co.uk>

    >
    >> Why are you using XHTML anyway. The most used browser out there does not
    >> understand XHTML which means you must serve it as text/html which means
    >> *every* browser is error correcting it to HTML. Why not just use HTML
    >> anyway?

    > I tried to write this page in html 4.01 strict and I had some problem
    > which forced me to go back to xhtml... But I forgot what was my
    > problem. Sorry. It is really stupid. :) I think, I will try to
    > rewrite the code in html again and if I meat this problem again I will
    > let you know.


    No reason to use XHTML. Stick with HTML unless you have some real reason
    to do otherwise.

    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
     
    Jonathan N. Little, Dec 11, 2007
    #16
  17. rf Guest

    <> wrote in message
    news:...
    > On Dec 10, 9:01 pm, "rf" <> wrote:
    >> <> wrote in message
    >>
    >> news:...
    >>
    >> > Here is my code:
    >> >http://www.showandbeshown.com/tmp2.php

    >>
    >> Ignore my other post. I was looking at the URL you had posted previously,
    >> silly me :)
    >>
    >> Now, which of the 23 errors are you referring to? I see no "does not
    >> allow"
    >> error?

    > Strange, I have 26 errors and the first of them is:
    > Line 52, Column 160: 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.
    > ...="4bf822382c741097d6b28e594ee4cdfa" /><div>
    >
    >>
    >> Why are you using XHTML anyway. The most used browser out there does not
    >> understand XHTML which means you must serve it as text/html which means
    >> *every* browser is error correcting it to HTML. Why not just use HTML
    >> anyway?

    > I tried to write this page in html 4.01 strict and I had some problem
    > which forced me to go back to xhtml... But I forgot what was my
    > problem. Sorry. It is really stupid. :) I think, I will try to
    > rewrite the code in html again and if I meat this problem again I will
    > let you know.


    Re-write? Not really. All you have to do is feed it to the validator and
    remove the spurious / at the end of some tags.

    --
    Richard.
     
    rf, Dec 11, 2007
    #17
  18. daze20

    Joined:
    Sep 20, 2011
    Messages:
    1
    People like you make me sick!

    @Jukka K. Korpela: Sorry, but whenever I come across dumb nerd comments like this it just makes me wanna puke! Why don't you just leave all the "I'm so clever and you're so noob"-**** and HELP THE GUY WHO ASKED THE QUESTION. Goddamit......really!
     
    Last edited: Sep 21, 2011
    daze20, Sep 20, 2011
    #18
  19. tallnhairy

    Joined:
    Sep 28, 2011
    Messages:
    1
    Can no longer see the code but this sort of validation error in forms usually comes from not using a fieldset to contain the inline elements. Wrap the inputs and submit in a fieldset if you have not done so already and see what happens :)

    ps.Totally agree with daze20's view on Jukka's earlier post, totally uncalled for snobbishness, more annoying than the "google is your friend" type of comment. I find half my answers in forums that have that comment posted somewhere within them. If you know the answer just write it down! If not or you dont want to then just dont write anything!
     
    tallnhairy, Sep 28, 2011
    #19
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jeff
    Replies:
    2
    Views:
    958
    clintonG
    Sep 19, 2006
  2. bbxrider
    Replies:
    9
    Views:
    8,384
    vijayakumarb82
    Oct 18, 2007
  3. vijayakumarb82

    document type does not allow element "a" here.

    vijayakumarb82, Oct 18, 2007, in forum: HTML and CSS
    Replies:
    0
    Views:
    3,593
    vijayakumarb82
    Oct 18, 2007
  4. Ryan Taylor
    Replies:
    1
    Views:
    692
    Ryan Taylor
    Sep 9, 2004
  5. Dave
    Replies:
    1
    Views:
    176
Loading...

Share This Page