dresden_phoenix — 2011-11-09T18:22:04-05:00 — #1
Let say you had a form for ...whatever. For example a poll.. whose title is important enough to be a header... "Whatcha doing for Xmas?" and some radio buttons and submit. Would you put the Hx tag inside the form tag or outside ? I would like to know what is considered best practice: <hx> </hx> <form></form> or <form><hx> </hx> </form>.
chris_upjohn — 2011-11-09T20:40:23-05:00 — #2
I would follow the same concept as how the <fieldset> element works personally, you have the legend then the form which makes it clear and easy to understand.
dresden_phoenix — 2011-11-09T23:22:14-05:00 — #3
so the does the fieldset represent the form tag ( the hx is within the form)?? or the Hx outside "then the form"? sorry I was kinda lost in your semantics.. no pun.
chris_upjohn — 2011-11-10T00:37:24-05:00 — #4
I was just referencing the <fieldset> element as a reference for the <legend> tag, basically in a semantic sense both of the examples below should yield the same SEO ouput since they are representing the content afterwards.
ralphm — 2011-11-10T01:38:18-05:00 — #5
The advantage of the Legend element (within a fieldset) is that the text is then explicitly associated with the form, too. But the code should be like this:
... other form elements ...
dresden_phoenix — 2011-11-10T03:58:49-05:00 — #6
Well my conundrum comes from the fact That in some cases I could already have fieldsets with legends.. or that the content may seem headline like.... Although for a poll question I can see how it would fit semantically to use LEGEND.
I suppose the feel I am getting thus far is that if a header must be involved it is best to put it outside the form tag.
stomme_poes — 2011-11-10T04:46:27-05:00 — #7
I put EVERYTHING that is not a form control outside the form. Every time (well, not counting when I've been told to add "help text", which I then either stuff inside a form control or use ARIA to associate it). Users with a UA that has a "Forms Mode" will be getting only form controls inside the form, except ARIA-associated stuff.
I put the header outside (and above), I put the instructions outside (above! I hate when the instructions are at the bottom, I don't see that until after I've already filled everything in), and legend-text (like "fields marked with * are required").
*edit by "legend-text" I mean like a map legend, not the <legend> element
Only on simple, dedicated form pages would I consider letting the (lone) legend do that work (often if it's redundant I'll just hide the legend rather than not have a header).
xhtmlcoder — 2011-11-10T05:57:59-05:00 — #8
In this specific case the heading would typically belong outside of the form since you are introducing the form.
dresden_phoenix — 2011-11-10T20:34:22-05:00 — #9
Yeah, makes sense. I was torn because I saw an opportunity to streamline the css and utilize an already existing container. BUT at the same time felt exactly the same way as what Mallory expressed. So I decided to do what any good leader would do and ask what everyone else was doing
stomme_poes — 2011-11-11T03:51:58-05:00 — #10
Haha, and as I come back to this thread, I'm currently battling a long, complicated single form who happens to have craploads of plain text inside it. It's sort of an output-like content, but the <output> tag is not correct for this case.
Now going to have to break my head trying to figure out how to present all this content inside a form (basically people are adding and changing bits of text; their set text is displayed later, and there's descriptions of what these types of text are... and there simply aren't correct form controls for this text. #doomed