Login or Sign up Help | Site Map
Connecting Tech Pros Worldwide

Fieldset

Question posted by: shapper (Guest) on June 27th, 2008 07:16 PM
Hello,

I am creating a form. It has a few labels, inputs and a submit button.
Should I place the button inside the same fieldset as the inputs and
labels? Or in a different fieldset?

Or maybe I should use the following approach:

1. If the form has only one fieldset then the submit button would be
inside the same fieldset has the inputs and labels.
2. If the form has more than one fieldset then the button to submit
the entire form would be placed in a new fieldset.

This is just an idea.

What is the best approach?

Thanks,
Miguel
Would you like to answer this question?
Sign up for a free account, or Login (if you're already a member).
Lance Manyon's Avatar
Lance Manyon
Guest
n/a Posts
June 27th, 2008
07:16 PM
#2

Re: Fieldset
On Tue, 17 Jun 2008 09:58:00 -0700 (PDT), shapper wrote:
Quote:
Originally Posted by
I am creating a form. It has a few labels, inputs and a submit button.
Should I place the button inside the same fieldset as the inputs and
labels? Or in a different fieldset?


I would place the whole form in one fieldset.

Hope you're well,
Ian
--
It is better to have loafed and lost than
never to have loafed at all. (James Thurber)
http://rastallian.blogspot.com/

Jukka K. Korpela's Avatar
Jukka K. Korpela
Guest
n/a Posts
June 27th, 2008
07:16 PM
#3

Re: Fieldset
Scripsit shapper:
Quote:
Originally Posted by
I am creating a form. It has a few labels, inputs and a submit button.
Should I place the button inside the same fieldset as the inputs and
labels? Or in a different fieldset?


On the practical side, it does not matter much.

The fieldset element is, in principle, an element for logical grouping.
Typically, you wrap a set of radio buttons and their labels inside a
fieldset, when they "work together", specifying a "one-of-many" choice.
Or you could use a fieldset that contains fields for a person's name
(e.g., surname, first name, middle name) and their labels; the fieldset
corresponds then to the concept "a person's name". However, such logical
grouping does not matter much to browsers, except for special rendering
of the entire fieldset. This is somewhat unfortunate, since you don't
always want that rendering, and it is difficult to kill it.

Moreover, a fieldset element must have a legend element. Often it is
easy and natural to write one, but not always. (However,
<legend></legendcan be used; it is valid, even if it does not sound
very logical.)

So I would group labels and inputs if they are logically related, and I
would not put a submit button there. I would use just <div><input
type="submit" ...></div>.
Quote:
Originally Posted by
Or maybe I should use the following approach:
>
1. If the form has only one fieldset then the submit button would be
inside the same fieldset has the inputs and labels.


It sounds a bit illogical, and the rendering might be somewhat
misleading to people who are already used to seeing fieldset display for
interrelated fields.
Quote:
Originally Posted by
2. If the form has more than one fieldset then the button to submit
the entire form would be placed in a new fieldset.


No reason to put the button in a fieldset, and there would be no natural
legend for it. _If_ you had several submit buttons (which is usually a
bad idea for certain practical reasons), then they might be grouped into
a fieldset, with e.g. <legend>Submit</legend>.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/


shapper's Avatar
shapper
Guest
n/a Posts
June 27th, 2008
07:16 PM
#4

Re: Fieldset
On Jun 17, 8:12 pm, "Jukka K. Korpela" <jkorp...@cs.tut.fiwrote:
Quote:
Originally Posted by
Scripsit shapper:
>
Quote:
Originally Posted by
I am creating a form. It has a few labels, inputs and a submit button.
Should I place the button inside the same fieldset as the inputs and
labels? Or in a different fieldset?

>
On the practical side, it does not matter much.
>
The fieldset element is, in principle, an element for logical grouping.
Typically, you wrap a set of radio buttons and their labels inside a
fieldset, when they "work together", specifying a "one-of-many" choice.
Or you could use a fieldset that contains fields for a person's name
(e.g., surname, first name, middle name) and their labels; the fieldset
corresponds then to the concept "a person's name". However, such logical
grouping does not matter much to browsers, except for special rendering
of the entire fieldset. This is somewhat unfortunate, since you don't
always want that rendering, and it is difficult to kill it.
>
Moreover, a fieldset element must have a legend element. Often it is
easy and natural to write one, but not always. (However,
<legend></legendcan be used; it is valid, even if it does not sound
very logical.)
>
So I would group labels and inputs if they are logically related, and I
would not put a submit button there. I would use just <div><input
type="submit" ...></div>.
>
Quote:
Originally Posted by
Or maybe I should use the following approach:

>
Quote:
Originally Posted by
1. If the form has only one fieldset then the submit button would be
inside the same fieldset has the inputs and labels.

>
It sounds a bit illogical, and the rendering might be somewhat
misleading to people who are already used to seeing fieldset display for
interrelated fields.
>
Quote:
Originally Posted by
2. If the form has more than one fieldset then the button to submit
the entire form would be placed in a new fieldset.

>
No reason to put the button in a fieldset, and there would be no natural
legend for it. _If_ you had several submit buttons (which is usually a
bad idea for certain practical reasons), then they might be grouped into
a fieldset, with e.g. <legend>Submit</legend>.
>
--
Jukka K. Korpela ("Yucca")http://www.cs.tut.fi/~jkorpela/


I use fieldsets since I might have grouping in my forms and I think
fieldset is a good way to do that ... If i don't want to display a
legend I can always do:

fieldset legend {display: none;}

But I think the grouping is useful in some cases.

In relation to the buttons, that was what I was thinking: to place a
div INSIDE the form to contain the buttons ...

Wrapping the buttons in a fieldset, even if more than one (for example
Submit and Cancel), does not make much sense to me ...

Thanks,
Miguel



 
Not the answer you were looking for? Post your question . . .
182,318 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).

  • Didn't find the answer you were looking for?
    Post Your Question
  • Top Community Contributors