Re: [VE][65] Div and Form

On 20/11/06, David Dorward <david@dorward.me.uk> wrote:
>
> On Sat, Nov 18, 2006 at 10:22:24PM +0100, Loc wrote:
> >    <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
> >    Username: <input type="text" name="user" />
> >    Password: <input type="password" name="pass" />
>
> >    The w3 validator says that these form elements are not allowed in a
> div.
>
> Are you sure?
>
> I'd expect it to claim that the form controls (not elements, there is
> only one form element in that code) are not allowed "here", where
> "here" is "as children of a form element".
>
> Form elements may have only block elements (such as fieldset or div)
> as children. These elements may then contain the inline input elements.
>
> (BTW, you should use the <label> element to markup the labels for your
> form controls.)
>
>
> --
> David Dorward                                      http://dorward.me.uk
>
>
I Don't know what you mean so I'll show this is my new code

<div id="userarea">

....php stuff with some echo's...

<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"
onsubmit="return validateloginform()">
<label for="user">Username</label> <input id="user" type="text"
id="username" name="user" />
<br />
<label for="pass">Password</label> <input id="pass" type="password"
name="pass" />
<input type="hidden" name="loggedon" value="Yes" />
<input type="hidden" name="whatuserIDisit" value="<?php echo "$UID"; ?>" />
<input type="submit" name="submit" value="Log In" />
</form>

....php stuff..

</div>

I get this error and 8 other that say almost the same thing just about the
other inputs, the submit, the <br /> and the labels.


******************************************
Error *Line 23 column 162*: 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.

....="a293dd8b4907c7c484d0e4bf9d456b8d" /*>*

 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>").

******************************************

-- 

Regards Loc

Received on Monday, 27 November 2006 21:23:49 UTC