Seriously...
well done for getting this far ðŸŽ‰.
We've only just begun that I hope you can start getting a sense as to how forms operate on web apps.
It's very, very simple once you understand the process.
Now, I want us to quickly talk about this update...
button. What happens when you submit the information?
The first thing you need to understand is that clicking the button tells the browser to validate all...
of the input elements in the form, and submit it to wherever you specify the action URL in your...
form.
In our instance, we haven't really defined a lot of validation.
Actually, we did with the email...
remember? We said it has to be a valid email,
so if we type "jhjh" and we try and update ... (error sound) look at that, your browser gives you an error message. It tells you...
to include an @ symbol in the Web address - that is built in validation by the browser.
We haven't yet discussed other validation techniques, but we will. But at least you know that's what...
happens when you click that update button.
The browser first does validation.
If the validation doesn't pass, it does not get submitted to the server.
The second thing that it does, is that it allows us to see all the information the user is sending to the...
server.
What do I mean? Well, let's type here name as Gerald ðŸ¦’,
email can be gerald@giraffe.com.
Let's say she Gerald ðŸ¦’ likes the color green, because he loves leaves ðŸŒ¿.
I am a very tall giraffe, and I am generally a happy person, in this case, an animal. But Gerald think he's...
a person. When this user clicks update, look what happens in your URL bar in the browser. Let me click update. (click sound)
How crazy is that? Everything after...
that question mark represents the variables in our form. Remember all those "name" attributes? Well, each input's...
name attribute is followed by an "=" sign, then its value. And each variable is separated by an "&" ...
character.
And you can imagine if we had a backend server, it would be pretty easy to pull out all of this information,
query a database, whatever you want to do, and let us know whether the form submission was successful or
not, or to grab some other information from a server to allow them access to a login page, for example...
there's so much we can do with all of this information.
So how cool is this, you can kind of already see that all the users information is submitted in the...
URL above, and the only reason for that is, is that we haven't specified the METHOD type in our form. Remember if we go to....
our HTML here...
and we look at our form...
we've just got a class, but we haven't put, for example, a method attribute of POST. "POST" puts it into...
the body of the HTML request.
At the moment, the default is GET.
So when we haven't put anything, it's the same thing as a GET request.
And that's why with a GET request, all the information is put into that URL.
But it's just very interesting to actually realize that information you fill in a form can be very easily...
accessible, by you anyway.
And that's why a lot of people also say it's much safer to put it into a POST request...
so it's not openly visible in the URL. But anyway, we're going to be talking a lot more about this...
later.
This is hopefully given you just a flavor of what's to come, of what's involved with the form...
and I can't wait to get into the next section and start discussing more complicated things.
It's going to be really, really fun.
Adios ðŸ‘‹.