02Geek HTML5 and JavaScript, TypeScript, React, Flash, ActionScript online School
Previous VideoNext Video

Integrate a textarea to your form

Time to explore new HTML tags that are going to be very handy when creating a form.

Video Transcript

00:00Welcome back. It's time to learn something new. So we said that there's a lot of different input elements
00:05We're not gonna see all of them
00:06But we'll see some of them we're going to take a small break from input elements because I want to show you
00:10Something very similar to text. So what would happen if you wanted to create a text?
00:15That's more than one line currently you have no way of doing it, but lucky enough. There is a way
00:21So I want to show you the other basically the way of adding more text inside
00:25so first of all what I'm going to do is I'm going to add a new element and this new element is called text area and
00:32Literally its name really explains itself contrary to the text which is inside of the input elements
00:37The text area enables you to write a lot of copy
00:40Alright so that that a lot of copy will basically translates into an element that basically for a refresher
00:47If I refresh the page you'll see that we have this nice big element enables us to write more than one line of copy
00:53Moreover than that in the mode many browsers will have this little triangle enabling you to make it bigger or smaller so you could continue
01:02Yeah, many forms have that if you look at this it depends on the browser that you're working with but most of them would
01:07Have that capability
01:09All right. So now you know how to create a text area, you know how to create a input text area
01:14Now the rules are very very are not very they're the exact same way
01:18So first of all, we want to set a name to it
01:21Because if we don't set a name then it won't send the information it wouldn't know to what variable to put it in
01:26So in this case, we're gonna give it a name and let's just put here some upper
01:30Some sort of random name. So that was for user. This was for password. This one will be for
01:37S for story
01:39Okay, because we want the user to tell us a story in here. All right, so to make that really work
01:44Let's you help me. Please mom. I usually see on different sides as comment
01:50Right. So yeah, so you want it. Let's do a comment here. So we'll put your C for commenting. Okay, sounds good
01:55Now let's put inside of our label. Let's give a label to that area. So I'm gonna put here a new label and
02:01The label itself its value is gonna be
02:05comments
02:06All right. So comments are gonna go right here. Now this alone is not enough, right?
02:11We didn't connect between our label and our name yet. Did we?
02:15No to make that happen. What we have to do is the same relationship that we did with the label and input
02:20So to do that, we're gonna add a new ID and the ID itself will add whatever name we want for it
02:25And again, this name here is for the submission form
02:29This name is not for the ID of the element the ID of the element is it could be the exact same name or a different name
02:35So I'm gonna call it CMT for a comment. Okay, once I created my ID, which is called comment
02:41I'm ready to tell my label that this comments field is related to this text area to do that again
02:47I'm just gonna type your for and I'm gonna type in the actual name which is CMT for comment and
02:53Just for this for spacing. I'm gonna put here a nice br break a line making sure that our text inputs will be below it and
03:00Not stay inside of it. So there we go. So now we created everything we need to make our new submission form actionable
03:08So if we click on a refresh and we reload
03:11Let's why not let's send the information. I put your user name
03:15fee
03:16Phi and comments will be foe and we click on the login and we're gonna send it
03:23When we send the submit because right now we're using a post and not a get right this
03:29So let's switch it around and call it a get once we do it again
03:32Then we'll be able to see the the results going through our browser. So let's again so he's gonna go fee
03:38Phi and
03:41Foe we're gonna log in sure. Why not? Oh, I didn't refresh tonight fee
03:53far
03:55foo
03:57For good luck never for the site. There you go
04:00All right
04:00So now we see the variables that were sent to because we're sending within the same submission form
04:04We see the user name is the you is for username and this is the value
04:09We see the P which is for our password and the password and we see the C for the foo
04:13And again, the only reason we see it now
04:14We didn't see it before is because we're using the method get which is a less secure method and it's a more visible method
04:20So you could actually see it in the URL itself
04:22And because our action is going nowhere, it's refreshing our page and appending those new variables into it
04:28Okay
04:29So that there we go about the text area
04:31That's all you need to know about the basics of how to work with the text area in the next video
04:35We're gonna explore a little bit more deeply into the text area and see different properties of how to control your text area
04:42Beyond that we're gonna learn the things that we're gonna learn for the text area
04:46Most of them are gonna be implementable to any text
04:50Input device such as the text or password so on and so forth
04:53So we'll see in the next video when we start adding custom properties to our text area. See you then

Ready to Level Up Your Skills?

Join thousands of learners on 02GEEK and start your journey to becoming a coding expert today!

Enroll Now for Free!