Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does fieldset have to be in a form?

Tags:

I dont know anything about DTD.

http://www.bls.gov/oco/ocos292.htm

See how fieldset is used outside of form on this page and it's cool! I love the style!

like image 344
datasn.io Avatar asked Mar 18 '09 13:03

datasn.io


2 Answers

I think the question and chosen answer in this question are misleading. Whether or not a form has to have a fieldset, and whether or not a fieldset has to be in a form are two different questions with two different answers.

According to the HTML4.01 spec, a fieldset is a valid element inside of a form, but as it is a standard block-level element, it is also acceptable elsewhere: http://www.w3.org/TR/html401/interact/forms.html#h-17.10 http://www.w3.org/TR/html401/sgml/dtd.html#block

I can not, however, imagine a use case where this would be done, unless you are using the fieldset for decorating, which would be incorrect usage.

A form however, does not require a fieldset: http://www.w3.org/TR/html401/interact/forms.html#h-17.3

like image 89
David Smith Avatar answered Oct 12 '22 08:10

David Smith


Bumping because no one gave a valid use case for a fieldset sans form. A valid reason to use a fieldset without a form is when you are using the inputs to gather information for a dynamic display. Each change of an input makes a difference in the displayed information. There is no sense of filling out a form and clicking submit. You could put a form around the fieldset, but it would be useless. The fieldset, however, visually groups the inputs used to control the display, (or game or whatever).

like image 33
phorgan1 Avatar answered Oct 12 '22 10:10

phorgan1