Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
Checkboxes are very common form elements that allow your users to make a single selection. Grouped together, they allow the selection of multiple related items. This gives you an alternative to using radio buttons, which only allow for a single selection. Dreamweaver gives us a choice when placing checkboxes in our form. We can either insert them one at a time or within a group. Even though our form has a lot of checkboxes, we'll place them individually so that we have full control over the accessibility and structure of our checkboxes.
So here I have the join.htm page open and our checkboxes are actually going to go in another section so we're going to scroll down a little bit and find our Tour Profile region. So go ahead and scroll down and find that. After Tour Profile hit Return to create a paragraph and type in 'I am interested in the following tours:.' So this looks like a label but it's not. It's going to be a paragraph and it's going to act as a sub-heading to the individual checkboxes themselves.
Now I'm going to hit Return to go down to the next line and we're going to begin putting in our checkboxes. Now we have several checkboxes. I think we have about 9 of them to place in so this is going to take us a little bit of time. However I do want to discuss the structure of what we're going to do here before we do it. Each checkbox is going to be in its own paragraph. That's going to make this form for the time being very tall, taller than it needs to be. Later on, when we discuss styling our forms with CSS, we'll move those checkboxes into a three-column layout, which is going to be a much nicer visual presentation. But for right now we're just going to build the initial structure.
Okay, so I'm going to place a checkbox on the page and you could find those right up here in your Form objects. They are in this little group right over here on the left-hand side and you just want to go ahead and click to insert a checkbox. Once again our accessibility attributes come up and the first one we're going to place on the page has an ID of backpack. The label for this will be Backpack Cal. So these are our tour packages. We're going to attach the label using a for attribute. We're going to have it after the form item. So notice how Dreamweaver switched automatically. Before this particular form item it was always before the form item.
Checkboxes and radio buttons are typically after the form item, so Dreamweaver at switches that automatically. However you should be aware of that just in case you wanted the label before it. The Tab Index here is going to be 110, a little further down in the form. Go ahead and click OK and there is our first checkbox. Now, I just did a very common mistake when you're placing checkboxes on the stage. Did you see I placed a colon in the label? I've got that everywhere else so you sort of getting a habit of doing that and you're like colon, colon, colon, okay good. Then you do it here and you go, oh yeah, I don't need that. So just go ahead and delete that and remember when you're doing radio buttons and checkboxes, that sometimes the rules are a little different.
Okay, now we have a lot of these to do so I'm just going to go ahead and do these in order placing in all the attributes. Just take your time. Don't worry about doing this quickly. We want to make sure you're doing it right instead of quickly. Speed comes with repetition. So I'm going to hit Return to go down to next. Once again I'm going to insert another checkbox. The ID for this one is going to be calm and the label for this one is going to be California Calm, with no colon I might add. The Tab Index here is going to be 120 and the other two options I can go ahead and leave the way they are.
I'm going to click OK and I'm just going to keep going. Now remember, after each one of these I'm going to insert a brand new paragraph by hitting Return. I am going to insert another checkbox on the page. This one's ID is going to be hotsprings and the label for this one is going to be California Hotsprings and the Tab Index for this one is going to be 130. Scrolling down a little bit more so I can keep an eye on these. I'm going to insert another checkbox. The ID for this one is going to be cycle and the label is going to be Cycle California.
Tab Index for this one will be 140. So we're just going up in increments of 10. Our next checkbox is going to be desert for the ID, the label is going to be From Desert to Sea, and the Tab Index for that one will be 150, and I guess From Desert to Sea would be better than Form Desert to Sea, right? Yeah, typos. Got to love them. All right. So I'm going to insert another checkbox and the ID for this one is going to be kids and that's going to be Kids California and the Tab Index for that is going to be 160.
The next checkbox ID will be nature and the label for that will be Nature Watch and the Tab Index for that is going to be 170. As I mentioned before I'm going through these kind of quickly but if this is to be you're first time ever placing checkboxes on the stage, you may want to pause the movie and go through each one of these individually and just verify that everything is exactly the way that you need it. I'm going to insert another checkbox on the page. This one's ID is going to be snowboard, the label will be Snowboard Cali with an I, and the Tab Index there 180.
One more. Place another checkbox on the page. This one's ID is going to be taste, the label is going to be Taste California, my favorite tour. The Tab Index is going to be 190, and there we go. Now we're done with all of our checkboxes but just so we can see the properties of that, go ahead and select any one of your checkboxes. It doesn't matter. Notice that each one of them has a checkbox name and then a status as to whether it's checked or unchecked. Now that points out something. There is supposed to be a checked value here and each one of these has absolutely no checked value.
Now, the checked value, much like with a radio button or a list menu item, that is the value that is sent to the form processing. So that is absolutely crucial. So we're going to go back up to our first checkbox and we're just going to start adding these to our forms. So although the accessibility attributes is a great dialog box, don't just assume that that is all of the information you need for these form elements. So with the first one selected the checked value for this one is going to be backpack. Now I'm going to use exactly the same thing that we used for the IDs for each of these.
So calm for California Calm, hotsprings, cycle, so you can just click on that. Take a look at the ID that's over there on the left-hand side of the Properties Inspector and just go ahead and type that in again. Or if you don't feel like typing you can obviously copy and paste those. Just remember to go through each one of those and make sure that the ID that's over here in the checkbox name is also what's going to be in the checked value. Now again that's an arbitrary value. It can be whatever is necessary for the form to process correctly and whoever is programming your form processing should let you know what you need.
In this case, let's say we were sending an e-mail. We could go ahead and create a field with an e-mail that would say Tour Interest and then it would just have the list of all of these that happen to be checked. So taste, calm, hotsprings, that would give us an idea as to which tours this person was interested in. Now while we have our checkboxes for each of our tour packages, they are not looking great. Not to fear, we'll be styling them shortly but for the moment I want you to focus on the fact that checkboxes allow a little bit more flexibility than what we're about to do next, which is radio buttons, and you're going to use checkboxes anywhere that more than one answer is allowed.
They're also very helpful when the question is a simple yes or no. You can use one checkbox and give the user the option of either checking it or not. This is a very common way to have people sign up for newsletters or online offers. Now we'll continue building our form in our next movie by adding a form element that is very similar to checkboxes as we insert radio buttons and radio groups.
Get unlimited access to all courses for just $25/month.Become a member
58 Video lessons · 59383 Viewers
61 Video lessons · 92296 Viewers
82 Video lessons · 104083 Viewers
56 Video lessons · 106833 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.