The fieldset and legend tags
The power to group things is not limited to Javascript or DIV's. When creating a form you can use the fieldset to group elements inside of your form together- you can even disable everything in that group with one attribute added into the group.
Video Transcript
00:00Welcome back. How are you doing Mom? Good. Hanging in there? I'm hanging in there. So we have two last new tags and
00:06then we have a little bit of fillers for this topic which is form fields. It was a
00:11big massive topic, a lot of things to learn in it. So let's just go right
00:16ahead. They're relatively easy. Their idea is really just to be able to group up
00:20different form fields. So if you have a really big form, you might want to
00:24group things up. They don't do anything from the form level, but they help you
00:28organize your information and enable you to do something that you just can't do
00:33without. So for example, let's just see what I mean by that. So let's start with, I
00:36want to group up the username and password and just set that to be like
00:38user information fields. Okay. So to do that, all I really have to do is I'm
00:44going to scroll up to our user information which is basically our user
00:47and password and I'm just going to group them up together. So I'm going to come
00:51here in the beginning and I'm going to create a new field set. Now
00:55literally what a field set does is nothing. All it really does is it boxes
00:59the content and says all this is one thing. Once I save that and I go right
01:04back into my browser and click on refresh. No, not that browser and click on
01:10refresh. We'll see that now there's like a box around our element showing us that
01:14this is a group. Okay. Yeah. Now beyond that you could control that with CSS if
01:18you know CSS, but we're not going to worry about visuals at all. And this is
01:21really just a means of organization. So in the field set itself, I want to add
01:26one more property which will be the title of the field set. Now the property
01:30that is used for that is called legend. And it's also a British slang
01:35for like something really, really wicked. So it's legend like she, that
01:40girl's legend. All right. So the legend itself is basically the definition of
01:45what that field set is. And again, it's just a visual indicator. So for
01:48example, here it could be user information, information, the legend of
01:53mall. Exactly. I have no idea what you just said, but exactly. Okay, so and then
02:00you see that you have this form and it's nicely formatted. We could create
02:03your own format formations beyond that. And that's really all it is. Now you
02:08might tell me, so Ben, why do we need to set it with this new tag? Why do you
02:12need new tags for it? Why not just use a H one and a div tag that we know
02:16about? What is the meaning of it? What is the meaning of it? And the answer of it
02:20is what is really cool and really simple. Remember when we learned in the last
02:23video about disabling things? Yeah. So you could actually disable a whole field
02:27set. All you have to do is just add the value disabled into it. Oh wow. Okay. Once
02:32you do that and you click on refresh, basically everything inside that field set
02:36is now disabled and not, you can't type anything into it. Okay, nice. Okay. So you
02:41see now, now you get the value of it and why do we use it? So it basically
02:44enables you to disable a big group of things and just one stroke.
