Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
I tend to find in classes that a lot of people even if they have been through HTML, and a full HTML class still may not have covered forms in too much detail. So what I want to do in this movie is go through the names of the different form fields and talk about why we might use one form field versus another. If you are already familiar with forms and all the various types of form fields, then this may just be review for you. But like I said, I tend to find a lot of people don't know this coming into creating the form from the back-end side of it. In other words, having to get a form working.
So let's take a look at the different types of form fields. Now, what I have done is simply opened up the contactus.php page from our website. So within Dreamweaver, I just chose contactus.php and previewed it in the browser by clicking this button, Preview in Firefox, or whichever browser you have listed in that drop down. Please do not feel like you have to use Firefox for this course. You can use your browser of choice.
So, here is our Contact Us form for Scuba Vacations. Let's take a look at these different form fields and talk about the differences between them. So what I have here is the name and e-mail field. And these are known as text fields. I can control the length of these text fields. In other words, how long it is visually to a user. I can also control how many characters can go inside these boxes.
Just because my box is this long, does not mean that's where my characters automatically stop. So, I have to put, in the form field, how many characters I want the user to be able to enter. Text fields such as these two allow you to control that length. This next one is a drop down menu, or some people call this a select box. The term select box comes from the HTML coding side of things where you're using the HTML tag called Select to create this menu.
Right now, we have five items available. I, as a user, can only choose one of these at a time. So, when they're going to Contact Us at Scuba Vacations. They choose one of these choices only, not multiple. There is a way to set up this menu, so you can choose multiple topics in a drop down menu. Our form is not set up that way. If you use the ability to work with multiple items in a drop down menu, there is some extra programming you need to do on your Script side, in order to accommodate that.
And since most drop down menus are just one choice for the user, that's what we're covering this course. So, these are text fields. This is a drop down menu, or at least that's how I will reference it. Here, we have radio buttons. The idea behind a radio button is the user is only able to choose one of the options. In other words, if I chose yes, no will be blanked out. If I switch to no, yes is blanked out. Radio buttons get their name from, just like a regular radio in the car, if you push on a radio station, you can only listen to one radio station at a time. That's literally where they got their name, radio button. Scheduled tour date This is a check box, and you can see there's a little check inside of it by default in HTML.
What a check box allows you to do is check multiple items. Now, this may not be the ideal situation, but this is set up in check boxes instead of radio buttons for a tour date, because we don't want to assume a user will only use one tour versus multiple. So hopefully, Scuba Vacations as a scuba diving tour company, has people signing up for more than one vacation in their lifetime.
So they may be able to have a tour over 60 days from now, at the same time, they have one coming up within 30 days. If we want to give the user more than one choice within a form, it's always going to be a check box. So, radio button, one choice. A drop down menu, you can do these in two different ways. This one is a single choice drop down menu. Check boxes allow multiple. And this big area here is known as a text area. It's a little bit different from a text field up above. In a text area, you cannot limit the number of characters the user could type in here.
So I can limit on a single line text field. But within this area, I have to program within my server-side script, a check to make sure the number of characters is not too many. In other words, I could write an entire book in this comments area and it would just keep going. Now, that's in basic HTML. A text area will allow whatever characters the user wants to put in. So if we want to prevent that, we have to do some programming from our end to stop that, and this last piece is a Submit button.
Without a button, specifically a Submit button, nothing is going to happen. Now, in older forms, when the web first started, we used to have a Reset button set up here as well. I tend to kind of pull people coming through my classes, and over the years, that Reset button has kind of diminished. Forms have gotten longer and longer on the web. And because of that, if a user accidentally clicks that Reset button, it wipes out all the form information that they just spent a half an hour filling in.
So users have gotten annoyed by the Reset button, but it's totally up to you if you want to provide one or not. We at Scuba Vacations have decided not to include a Reset button, so we just have our Submit button. And I could click this a million times if I wanted to. Right now, if I click that, notice I'm taken to the Contact Us action page and everything stops. That's because we have to build this action page, and then we also need to, from this action page, send the user to another page, which I call the Thank You page.
Because usually on that page you're going to thank them for submitting the form, and then give them some additional information beyond just the thank you. So those are the different types of forum fields, and we're going to look at different ways to create them including working with spry validation fields that look very similar, but they have some features built in to them that are pretty cool. We'll also look at blocking this. So when I click this button, nothing will happen until the user has filled information out correctly.
So those are the various types of form fields with an HTML form.
Get unlimited access to all courses for just $25/month.Become a member
82 Video lessons · 98207 Viewers
61 Video lessons · 85506 Viewers
71 Video lessons · 69469 Viewers
56 Video lessons · 101807 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.
Your file was successfully uploaded.