I don't want to sound like a broken record, but learning about the form element is incredibly important.
But where did it all begin?
That's a good question.
The <form> was introduced in the HTML2 specification.
Basically, it's been around since "pa fell off the bus".
That's an expression in Africa, by the way...
it just means it's been around for a very, very long time ðŸ¦–.
And why was this <form> created?
We've mentioned it before.
The form element was designed to contain other form widgets or controls.
And rather intuitively, it's mostly used to gather information from a user.
Pretty obvious...
nothing you don't know already.
What's very, very important with forms, though, is the amount of attributes we can attach to it.
There are many attributes for a form,
these are just some of them.
And we're going to be talking about these in this course.
Some of these can be very complex.
Some of these can be very confusing unless you've been in the industry for many years, such as exactly...
what the "accept-charset" is, or the "enctype".
But the two most important attributes are what? We've already mentioned them before, so you should get...
it.
That's right, it's the "action" and the "method".
So right now, let's just forget about everything else and look at these "action" and "method" attributes.
Remember the action? That indicates where you're sending the form data.
Basically, it tells your browser the location of the script that's going to process the form data.
And that's why that action attribute is very, very important.
The method attribute on the other hand, indicates how the browser should attach the form's...
data, to the request. POST is preferred because it embeds the information in the body of the HTTP request ðŸ˜¬.
But don't stress...
I know that might sound confusing.
We're going to get into a lot more detail, later.
We've already seen the GET request.
Remember, that's the default method on a form.
And we saw when we submitted all the data in our form that we built, it was appended to the URL.
So far, so good.
It's not that bad.
Let's move on.
Don't get overwhelmed with all the detail...
just remember that apart from these attributes and a few others we haven't yet discussed, the form...
is just a container.
In fact, it looks like a cup.
I want a container.
There you go - that's more like a container.
What does it contain if it's a container?
Well, we know it contains other form controls. And what do I mean by form controls? I just mean it contains things...
like buttons, or inputs, or fieldsets and a whole bunch more.
This is the most important thing for you...
remember when it comes to the form element. "Yes Clyde, I understand it's just a container, but what...
do some of these attributes do?"
Well, that's exactly what we're going to discuss next.