[thelist] where should form inputs go for valid xhtml?

Hershel Robinson hershel at galleryrobinson.com
Thu Aug 10 14:54:44 CDT 2006


Sarah Adams wrote:
> 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.

Why is it that you don't 'need' one? If you are using "<input> tags" 
then it sounds like you are attempting to represent in HTML a set of 
input fields. The tag used to informationally contain such as set would 
indeed be the <fieldset> tag.

You may not 'need' one for the visual effect, but I generally recommend 
approaching HTML not as a tool for creating a visual render in a 
browser, but as a tool to represent information. Given that approach, it 
sounds like a <fieldset> tag would be in order.

Then you can of course use CSS to do whatever styling (or unstyling) you 
like.

HTH,
Hershel

-- 
Web Site Construction by Gallery Robinson
http://galleryrobinson.com/



More information about the thelist mailing list