Building Data-Driven Web Apps with Flask and SQLAlchemy Transcripts
Chapter: User input and HTML forms
Lecture: Registration form
Login or
purchase this course
to watch this video and the rest of the course contents.
0:00
The login and register out's in place.
0:02
Let's go try to register.
0:04
Well, there's not a whole lot going on over here
0:06
that we can use yet is there?
0:08
Like our registration form is non existent.
0:11
So let's go do the html side of things
0:13
to add our registration form over in our template here.
0:17
Now we've got this little div action
0:20
and actually that should be a form right there.
0:23
Let's go ahead and put this on the inside
0:24
and then we have a couple of inputs.
0:26
So we have an input type equals text
0:29
and we're going to have an input type equals password.
0:33
We'll have another one of those.
0:34
And then we'll also have a button and it'll say register.
0:38
Okay let's see how that's coming along.
0:40
Yeah, that says okay.
0:42
You know what goes in here?
0:43
I don't, not yet.
0:45
So let's go ahead and we could either add a label
0:47
but as you've probably already noticed from me
0:49
I prefer placeholders, so we'll say your name
0:53
this placeholder will be your email address
0:57
this placeholder will be your password.
1:01
Now oftentimes on registration you'll see password
1:03
and confirm password 'cause oh my gosh
1:06
what if you type in the password wrong and you can't login?
1:08
In any real site, what you're going to have to do
1:10
no matter what, is have a reset your password option
1:13
where you send them an email and they reset their password.
1:15
So if they get it wrong they can just do that alright.
1:18
We don't have to actually double that up here.
1:20
And let's go and set the type on this to be submit
1:23
How are we doing? Better, not amazing, but better.
1:28
Can we submit our form? Let's go find out.
1:31
We click register, here you can see
1:32
it's actually posting back.
1:34
We do a get, it's posted here and then it's posting here
1:37
when we submit it so
1:38
this runs when we request the page but this
1:40
every time I click the button, it's running.