Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
Creating an accessible form takes a minimal amount of work, and the increased access that you give 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're 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 your forms more accessible.
So I have the form_practice.htm file open, from the 10_03 directory. The first thing I want to do is point your attention to a preference that we set very early on into the course. So if I go to Edit and choose Preferences, of course that's Dreamweaver>Preferences on the Mac, and I go to our Accessibility category up top, Form objects should already be checked, because we did that very early on, and that's also the default for when you open up Dreamweaver for the very first time. So that's something that you really shouldn't have to set. You should only have to set that if somebody has come in and turned it off, for whatever reason. Okay.
Now, so what does that actually do for us? Well, what I'm going to do is I'm going to go ahead and a place a form on the page. I can do that by going up to the Insert Toolbar and clicking on Forms. These are all of our form objects and you can pretty much build everything that you need for a form just from using these objects. Occasionally you may have to put something else on the page, or hand cut something, but for the most part everything that you need is right in front of you. So the first thing I'm going to do is go right over here to the far left-hand side of the Form objects, and I'm going to insert a form on the page. Now, when I do that, Dreamweaver gives me this nice sort of red dashed line around the form.
That's going to help me make sure that whenever I place a form element on the page, it's in the proper element. If I place a form element, for example, in a div tag below this, it wouldn't be inside the dashed red line and I would know that it wasn't applied to that particular form. Now, if I open up the Properties Inspector, when you place a form on the page, you have an opportunity to go ahead and give the form a Name, define its Action and its Method. Now, we're going to do that in a moment. What I'm really focusing on right now is what type of accessibility features Dreamweaver has for us when we begin to put form elements on our page.
So I'm just going to go up to probably the most common of all Form objects, which would be a Text Field. When I click on that, I'm now presented with a dialog box, and the reason that I'm presented with this dialog box is because I turned those Accessibility Preferences on. Now, making your Form elements more accessible is of course a very worthy goal and something you should strive for, but I'll be honest with you, there's an additional benefit to having these preferences come up. Now, instead of having to hand code things yourself, or create the labels yourself, you can do everything all at once with a single dialog box.
So I really can't think of any good reason to turn those preferences off. So I can here give this form element an ID, let's say I name it name for example. I can give a Label like Name and that would be the text that's going to show up beside it, above it, or below it, and I can decide exactly how to attach this. Now, in terms of attaching the label, what this means is you're going to have an input element and that's your text input, and then you're going to have text, which is surrounded by a label tag. Now it's upto you how this is all structured, because you have several options. The first is to attach a label using a 'for' attribute, and that will give you a separate label tag and a separate Input tag, and then it uses a 'for' attribute inside of the label tag to point to the ID of the input form elements.
So it's sort of a way of tying those two together and relating them. The Wrap with label tag basically means that the label tag itself wraps both the text and the form element, so both of them will be contained inside of the label tag. Or you have the option of No label tag at all. My favorite method of doing it is attaching it using the 'for' attribute and unless I have a very good reason for not doing that, I almost always do that one. I can also choose to Position that label Before or After the form item. One of the things that you're going to notice as you begin to place form elements on the page is that different form elements have different defaults.
So for a text input field, for example, the default is going to be before the form item, but for a checkbox, for example, it's going to be after it. So keep a watch on that, and if you want something different than what you're seeing there, you're going to have to select it. We also have the ability to do an Access key or Tab Index. Access key of course would allow somebody to use the keyboard to focus in on the form element, and a Tab Index is the order in which the form elements should be tabbed through, and Tab Index is something that we'll be doing as we place our form elements on the page. So when I click OK, it places the label and the form element on the page, and if I look at Split Screen View, I can see what it has done for us here.
There's our label surrounding name. Notice it says for name, and then we have the input tag whose name is name. I probably should have used something else, because that's kind of confusing. But let's just say we'd named it Fred right. So its ID would be Fred, and then it would be for Fred right there. All right! So that gives us a little bit of a clearer picture, atleast I hope it does, as to what our responsibilities are when creating forms and what we can do to make them a little bit more accessible. Accessibility options for other form elements will be discussed as we create our forms and places elements on the page.
With this information in mind, we can now proceed and begin creating our information request form.
Get unlimited access to all courses for just $25/month.Become a member