Start learning with our library of video tutorials taught by experts. Get started
Viewers: in countries Watching now:
In Dreamweaver CS5 Essential Training, Adobe Certified Instructor James Williamson explores the tools and techniques of Dreamweaver CS5, Adobe's web design and development software. This course covers both the ins and outs of Dreamweaver, as well as recommended best practices for crafting new web sites and files, the fundamentals of HTML and CSS, and how to ensure clean and accessible code. The course also includes how to use tools in Dreamweaver to create and style web pages, manage multiple sites, and add user interactivity with widgets and scripting. Exercise files are included with the course.
Creating an accessible form takes a minimal amount of work. The increased access that gives your users to your site makes it well worth the extra time. Just as with images and tables, Dreamweaver has accessibility features built into its form creation tools. Once you set the accessibility preferences for form elements in Dreamweaver, you are prompted from then on to set accessibility settings for form elements as you build the form. This workflow makes the process of building accessible forms quick and painless.
Let's take a moment to set our form accessibility preferences and review what you can do to make forms more accessible. So I'm just going to go right up to my Preferences. On the PC, that is Edit > Preferences. On the Mac, of course, it would be Dreamweaver > Preferences. Once again, I'm going to go to my Accessibility category. I'm just going to verify that form objects is checked. Again, that is the default. So unless someone has gone in there and manually changed that, that should be the case. I'm just going to go ahead and click OK and go right back on to my page. Now what does that mean to have accessibility preferences turned on for your form? Well, what that means is that as you begin adding form elements to your page, Dreamweaver is gong to begin prompting you for certain accessibility attributes.
The best way to see that of course is to do it for yourself. So let's just jump in and do this. I have the form_practice file opened in the 12_03 directory. It's a totally blank page. So just go ahead and place your cursor anywhere on the page. What you want to do is go up to your Insert panel and focus on your Forms objects. That's what we're going to be using for the overwhelming bulk of this particular chapter. So you can just sort of set that as you're working in this chapter and forget it. We're going to be using forms a good bit. So the first thing I'm going to do is just go ahead and place a form tag on the page.
Anytime that you're building a form, that should be step number one, insert a form tag. You'll find the form tag insert icon right up here in our Insert panel. It's the very first icon in the Forms group. So it looks like a little box with a red border. I'm just going to click to insert that on my page. Now, Dreamweaver is going to display forms for you visually with this red dashed outline. That's very helpful because it allows you to make sure that all of your form elements and everything that belongs to your form is inside of the form tag. Otherwise, the form tag is invisible and you really wouldn't see it.
So I always put frm on the front end of it, but again, personal choice. Now the Action would be the link to whatever processing page. We don't have a processing page so we'll have to discuss that when we create our own form. Same thing for Method. We just wanted to give our form a name. Okay, now making sure that your cursor is inside of your form, what we're going to do now is start inserting a form element on the page and see what Dreamweaver does to ensure that we have accessible form elements. So the first form element we're going to place on the page is probably the most common and that is the text field.
So I'm just going to go right beside the form tag, find text field and click to insert that. So here we have a fairly large dialog box that comes up. This is our Input Tag Accessibility Attributes. So the reason we're seeing this is because we turned on our accessibility attributes for forms. The first thing that Dreamweaver wants to know is okay, what ID do you want to give this? We're just going to go ahead and title it name. Now, what this is going to be is this is going to be the ID attribute for the input tag. The text field is a special type of an input tag. By giving this an ID, we're doing a couple of things.
Number one, we're identifying it as a unique form element, but number two the ID that we give this is often the same exact name of this column within whatever database this form might be submitted to. That'll assist anybody that's writing server- side code to match form values to the database. It's not required, but it's a really good idea that if you're working with the individual that's going to be creating the processing script for your form, just ask them what you want the ID to be for each of the input fields. Now label is the text that's going to show up beside the form. So a lot of times people will type in the text first like first name, last name, address, and then add the form element.
Through the use of this dialog box, we don't have to do that. Not only do we not have to do that, but we're getting the added accessibility benefit of placing a label on the page. So, our label for this one is going to be User name, and then a colon. Now, we have some options here about how this label is going to be related to the form element. We can either attach the label tag using a for attribute, wrap with label tag, or just don't put any label tag on at all. Well, we're going to use the for attribute, not only for this example but for the rest of our form as well. As soon as we place this on the page, I'm going to go in to code and talk about why we're going to be doing it this way.
Notice we can also position the label either before the form item or after it. That's usually going to change based on what type of form element you have. For text fields, most people are used to seeing the Before form item, so we're going to keep it that way. For Access key, we're going to leave that one blank, but that is a nice accessibility attribute if somebody is using a screen reader or other type of assistive technology. Access keys can be a sort of a nice shortcut as a way of getting into that particular form element. Tab Index is something that at a minimum you should do. That's going to tell whatever browser or user agent was processing your form which order the form element should go in if somebody tabs through the form.
That's extremely helpful and yes, forms will do that sort of on their own, but then it's up to the user agent or the browser agent to determine the order. They don't always get it exactly right. So I'm just going to put in a Tab Index of 10 and click OK. So there is our form element. As I mentioned before, I want to switch over to Code View really quickly and talk about what's going on here. Well, this is the input tag. This is our text field. Notice that the type attribute is set to text. That's what makes it a text field. Notice that we have both the name and ID attribute. They are the same as the ID attribute we gave the form element when we placed it on the page.
There is our tabindex. Now, here is the label. Now basically, the label tag is used to relate text to a form element. That lets any type of device out there know that this text applies to that form element and it can be incredibly instructive if somebody is not accessing your page visually. Now the reason that we use the for attribute and the reason that I like this so much, notice that it says label for="name". So it's looking for this ID, right here, name. It's relating those two to each other. That allows you to have the label in one place and the form element in another.
That can be extremely handy when you're laying your forms out, especially if you want your labels and your input text fields to say be beside each other or stacked on top of each other. It just separates them. The other option is to just go ahead and wrap that. Let me show you what that would look like. If you removed the for attribute and took the label tag and just surrounded the input with it, now since that's all one unit it's a little bit easier for user agents to say okay, these two are related. But from a styling standpoint, it's a lot harder for us. So that is why I personally really like to use the for attribute for the label tag.
Okay, so hopefully, that gives you a little bit of a clearer picture as to what our responsibilities are when creating forms and what we can do to make them a little bit more accessible. Other accessibility options, such as the Fieldset and Legend tags when we're dealing with forms, will be discussed as we create our forms. With that information in mind, we're now ready to create our Explore California registration form.
Find answers to the most frequently asked questions about Dreamweaver CS5 Essential Training.
Here are the FAQs that matched your search "":
Sorry, there are no matches for your search ""—to search again, type in another word or phrase and click search.
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.