[thelist] where should form inputs go for valid xhtml?
Rickards, Julian (NDM)
julian.rickards at ndm.gov.on.ca
Thu Aug 10 13:57:44 CDT 2006
<input> tags are inline tags that must be contained within a block tag.
For example, if you have a form with a field for First Name and a field
for Last Name to appear on separate lines, such as
<label for="first_name">First Name:</label> <input type="text"
id="first_name" name="firstname" />
<label for="last_name">Last Name:</label> <input type="text"
id="last_name" name="lastname" />
...you must enclose them in either <p> or <div> tags as in
<p><label for="first_name">First Name:</label> <input type="text"
id="first_name" name="firstname" /></p>
<p><label for="last_name">Last Name:</label> <input type="text"
id="last_name" name="lastname" /></p>
HTH,
Jules
-----Original Message-----
I just ran a form I'm working on through the W3C Markup Validator and
I'm seeing this error for most of my <input> tags:
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 really don't want to add a bunch of useless markup to my form simply
for the sake of validation - but I want validation! :) I was thinking of
enclosing the whole thing in an unstyled fieldset, since that would only
mean adding one extra tag, but it still doesn't feel quite right to add
a fieldset where I don't actually need one.
Any ideas?
More information about the thelist
mailing list