text
stringlengths
1
81
start
float64
0
10.1k
duration
float64
0
24.9
again using that same HTML as before.
1,784.31
2.29
We'll call the page Form.
1,786.6
2.65
And inside of the body of this page now, let's say
1,789.25
2.73
that I want to create a form that gives the user an opportunity to provide
1,791.98
3.81
their full name, for example.
1,795.79
2.1
How do I do that?
1,797.89
1.12
Well, the first thing, I need is a form element, some way of saying,
1,799.01
3.03
here is going to be a form.
1,802.04
2.39
And now, inside of that form, what are the various different parts
1,804.43
3.15
of the form?
1,807.58
1.02
Well, there's really two parts that you might imagine to this form.
1,808.6
3.18
One is a place for the user to actually type in their name.
1,811.78
3.18
And they probably also need some way to submit the form, some button that
1,814.96
3.27
just says submit, such that they can click on that button
1,818.23
2.76
in order to submit the form.
1,820.99
1.86
So how would we do that?
1,822.85
1.48
Well, in order to create an input field, we're
1,824.33
2.24
going to use an input tag, who's type in this case is going to be text.
1,826.57
6.86
There are a number of different ways that users
1,833.43
1.96
might provide input to a form.
1,835.39
1.44
They might type in text.
1,836.83
1.17
They might choose from a dropdown menu.
1,838
2.04
They might choose from a radio button option.
1,840.04
2.64
Or they might provide input as by clicking on a button, for example.
1,842.68
3.06
In this case, we're specifically using the type attribute
1,845.74
2.88
to say that when the user is providing input in this way,
1,848.62
2.7
the type of input that they're providing is going to be some kind of text.
1,851.32
4.53
Then, we might provide a placeholder, some default text that's
1,855.85
4.23
going to be inside of that input field the first time
1,860.08
2.55
the user looks at the page.
1,862.63
1.57
So, for example, the placeholder might be Full Name.
1,864.2
2.75
That way the user knows that what they should type into this placeholder
1,866.95
4.77
is their own full name.
1,871.72
2.19
And then finally, we're going to go ahead and give a name to this input
1,873.91
3.69
field.
1,877.6
0.5
Now, this isn't going to be something that the user sees
1,878.1
2.33
when they visit the page.
1,880.43
1.07
But anytime you submit a form, when we receive that forum in our web
1,881.5
3.99
application-- something we'll explore later on--
1,885.49
2.31
we need some way of knowing which input field corresponded to which value.
1,887.8
4.92
And so we're going to name each of the input fields
1,892.72
2.46
just so that later on we'll be able to reference them.
1,895.18
2.99
And, for now, since the user is typing their full name here,
1,898.17
2.95
we could just name this full name.
1,901.12
1.74
Or we could more succinctly just say name as the Name of this input field.
1,902.86
5.39
After that, we have an input field where the user can type in their name.
1,908.25
3.45
And now, we need some way for the user to be able to submit this form.
1,911.7
3.6
So we might say something like input type equals
1,915.3
3.66
submit to say, here's a way for the user to submit the form,
1,918.96
4.47
type equals submit means.
1,923.43
1.38
This is how they're going to submit the form when they're done completing it.
1,924.81
4.51
Now, if I open up form.html, this is the page
1,929.32
3.78
that we're ultimately going to see when we load this HTML.
1,933.1
3.06
This entire page just contains a single HTML form.
1,936.16
3.17
But that HTML form contains two parts.
1,939.33
3.05
The first part was this input element here
1,942.38
2.45
that allowed an opportunity for the user to type in their full name.
1,944.83
3.06
They type in their full name into this input field.
1,947.89
2.26
And when they're done, they can click this Submit button
1,950.15
2.48
to indicate that they would like to now submit this form.
1,952.63
3.69
Of course, right now, this form isn't going to do anything when we type
1,956.32
3
in our name and click Submit, because we have an added and a logic in order
1,959.32
3.15
to handle this form.
1,962.47
1.53
But later on, as we transition into the world of building web applications
1,964
3.12
using Python, we'll see how we can design a form,
1,967.12
3.16
such that after the user submits it, we save information to a database
1,970.28
3.53
or display some sort of results back to the user,
1,973.81
2.67
all by using the power of building these web applications
1,976.48
2.88
and connecting them to these sorts of HTML forms.
1,979.36
3.42
And HTML forms can actually get quite a bit more complex.
1,982.78
3.13
We'll take a look at another example.
1,985.91
1.55
For instance, let me open up form1.html, which
1,987.46
4.83
is a form that I built in advance, which shows a number of other ways
1,992.29
3.9
that users can provide information as input to an HTML form.
1,996.19
4.02
Here, we see an input whose type is text,
2,000.21
3
meaning we want the user to type in their name as text.
2,003.21
3.08
But you might also imagine that if a user is logging into a website,
2,006.29
3.13
for example, they might in addition to typing in a text-based name or username
2,009.42
3.84
or email, also provide a password.
2,013.26
2.34
And generally, if you've been on a website and you've typed in a password,
2,015.6
3.09
the password characters don't all show up as the actual characters.
2,018.69
3.72
For security reasons, they generally show up as just little dots
2,022.41
3.12
on the screen hiding the actual characters that they're representing.
2,025.53
3.61
And in HTML, we can do that very easily by just
2,029.14
2.96
saying that the type of this input is password.
2,032.1
3.42
If they're typing in a password, our web browser
2,035.52
2.01
will know not to actually display those individual characters.
2,037.53
4.63
In addition to just text-based input, we also have radio button input,
2,042.16
3.48
as I alluded to a moment ago.
2,045.64
1.84
So here, we have a number of different radio inputs,
2,047.48
3.17
where the user might be able to select from a number of options,
2,050.65
2.74
choosing their favorite color, for example,
2,053.39
2.19
from a number of these options.
2,055.58
1.67
And finally, just to take a look at one other additional feature of HTML5,
2,057.25
4.47
in fact, a new feature of HTML5, is something
2,061.72
2.67
we might call a data list, where we might
2,064.39
2.43
have the user choose in a dropdown from a number of different options.
2,066.82
3.75
But we want to very quickly filter down or autocomplete based on those options.
2,070.57
4.3
So if the user needs to select what country they're from, for example,
2,074.87
3.3
we might have an input field and specify that it's
2,078.17
3.38