Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:01,070 --> 00:00:05,990
The layout of our application is pretty well coming together at this point, however, if I enter in
2
00:00:05,990 --> 00:00:11,690
some clearly invalid email and then click on the submit button, I'm presenting no feedback to my user
3
00:00:11,690 --> 00:00:14,040
to let them know that this email is not valid.
4
00:00:14,600 --> 00:00:18,770
So in this section, we're going to start turning to the actual submission of this form and figuring
5
00:00:18,770 --> 00:00:23,840
out how we can validate the values inside these inputs and then eventually access the values that the
6
00:00:23,840 --> 00:00:24,660
user entered.
7
00:00:25,490 --> 00:00:29,390
So to get started, we're going to take a look at a quick diagram that's going to layout this process.
8
00:00:30,520 --> 00:00:36,070
OK, so here's the steps, everything is going to start up here and step number one, the user pressing
9
00:00:36,070 --> 00:00:36,940
that submit button.
10
00:00:37,060 --> 00:00:41,290
It's only when the user presses the button that we're going to start the validation process.
11
00:00:41,920 --> 00:00:48,040
When the user presses the button, the unpressed callback that we added to our raised button, which
12
00:00:48,040 --> 00:00:49,290
it is going to be invoked.
13
00:00:49,810 --> 00:00:54,580
So if you recall, down at the bottom, we have our submit button right here.
14
00:00:55,210 --> 00:00:56,650
Here's the race button widget.
15
00:00:56,800 --> 00:01:00,060
And on the reset button, we added the on pressed callback.
16
00:01:00,460 --> 00:01:04,599
So any time a user presses the button, this function right here is going to be invoked.
17
00:01:05,050 --> 00:01:09,730
So this function is going to be the perfect location for you and I to add some location to attempt to
18
00:01:09,820 --> 00:01:13,150
validate the form and then eventually access the values inside of it.
19
00:01:16,090 --> 00:01:21,730
So once we had that call back in, or I guess we already did, once that call back is invoked, we're
20
00:01:21,730 --> 00:01:28,120
going to attempt to access the form widget and we're going to tell that form widget, hey, you need
21
00:01:28,120 --> 00:01:31,690
to validate all of your text form field children.
22
00:01:32,410 --> 00:01:39,010
So quick reminder, here's our widget hierarchy inside of our hierarchy of the login screen.
23
00:01:39,130 --> 00:01:43,470
We created that form widget and we just very quickly brushed over it.
24
00:01:44,020 --> 00:01:47,820
So inside of our build method right here, here's the build method here.
25
00:01:47,860 --> 00:01:50,710
Is that where we created a form widget instance?
26
00:01:52,180 --> 00:01:57,940
So we need to get direct access to that form and we need to tell it, hey, you need to find all of
27
00:01:57,940 --> 00:02:02,920
your text form field children and you need to tell them that they need to validate themselves and make
28
00:02:02,920 --> 00:02:05,200
sure that they have appropriate inputs.
29
00:02:06,220 --> 00:02:12,280
Now, behind the scenes, any time that we place a form widgets with some text form fields as a child
30
00:02:12,280 --> 00:02:20,230
to it, the form gets this kind of behind the scenes direct connection to those child text form field
31
00:02:20,230 --> 00:02:20,700
widgets.
32
00:02:21,250 --> 00:02:27,700
So this form right here knows about the existence of this text form field and it knows about the existence
33
00:02:27,700 --> 00:02:29,440
of this text form field.
34
00:02:29,920 --> 00:02:33,370
That's a behind the scenes connection that it's made for us automatically.
35
00:02:33,730 --> 00:02:39,760
And it doesn't matter that there's the column which in between the form, just knows that these text
36
00:02:39,760 --> 00:02:41,710
form fields exist as children.
37
00:02:43,860 --> 00:02:49,170
So all we have to do is get access to the form which in itself and tell it to go find its children and
38
00:02:49,170 --> 00:02:50,210
attempt to validate them.
39
00:02:51,350 --> 00:02:56,690
Then if all those different fields are valid, we're going to then attempt to actually extract the values
40
00:02:56,690 --> 00:02:58,070
that a user entered into them.
41
00:02:58,880 --> 00:03:03,140
And then once we had those values, well, that's the last step here and we'll figure out what we'll
42
00:03:03,140 --> 00:03:04,170
do when we get there.
43
00:03:04,220 --> 00:03:06,410
We definitely have a lot of stuff to do before that.
44
00:03:07,620 --> 00:03:12,030
So in terms of difficulty or the actual implementation of all these steps, I think you'll agree with
45
00:03:12,030 --> 00:03:17,400
me that step number two, one and two right here are pretty straightforward, like we really know how
46
00:03:17,400 --> 00:03:18,580
to add that call back in.
47
00:03:18,630 --> 00:03:19,920
We already did it right here.
48
00:03:20,670 --> 00:03:22,830
So it's really step three where things get interesting.
49
00:03:23,850 --> 00:03:28,860
On step number three, we need to somehow get a reference to the form widget.
50
00:03:30,220 --> 00:03:35,530
And we need to somehow, like, run a method on it that tells it to try to find its children and validate
51
00:03:35,530 --> 00:03:37,510
them, so that's going to be the hard part here.
52
00:03:37,720 --> 00:03:39,060
Let's take a quick pause right now.
53
00:03:39,070 --> 00:03:43,120
We'll come back to the next section and talk about how we're going to achieve step number three.
5559
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.