Start learning with our library of video tutorials taught by experts. Get started
Viewed by members. in countries. members currently watching.
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.
Occasionally you'll create forms that have information that the user is required to fill out. Our registration form for example will require a username and password to be submitted before the user can register for our site. How we inform the user of this requirement is up to us. But it is fundamental to good form design. One option is to simply write the requirement next to the form element. A more thorough option is to add some type of form validation to your form. Form validation comes in two flavors: server-side and client-side.
So, go ahead and place your cursor inside that fieldset and hit Return. Now, don't freak out if Login Information shows down here. Remember Dreamweaver just having a hard time to display that. It's okay. And what we're going to do is we are going to go up to our form objects and these little green icons on the right-hand side those are your Spry Validation widgets. The first we are going to use is a Spry Validation text field. I am going to go ahead and click to add that, and you are going to see the Input Tag Accessibility Attributes come up just as you would within the other form element. And that's one of the most popular misconceptions that I want to go ahead and get rid of right here.
Now just like any other form element you can style them, so I am going to go ahead and click the text box to select it, so I am going to focus right there on the text input and I am going to change the Class to text. There you go! So, that is it's the same width and the same layout arrangement as our other text fields. So, when you first start out you won't really see any difference. Now, how do these things differ? Well, you see they have a blue outline around them and we have a blue tab in the upper left-hand corner. Go ahead and click that blue tab. Your Properties Inspector is now going to reflect the properties of your Spry Validation widget.
For Type, I am just going to grab the pull-down menu and take a look at these options, but for what we're doing here for the username, we are going to allow anything to be typed in. If you needed to filter this, for example, if it needed to be a phone number or an e-mail address or a ZIP code, you can go ahead and do that and the Spry Validation widget will basically look for that type of an object typed into it. We are actually not going to put any constraints on this. We just want it to be required. Now your form validation field is going to have several preview states, based upon the options that you choose.
The initial value is going to be like any other text field. However, notice what happens if somebody doesn't fill it out. They are going to get this message. So, if you grab the Preview state and go down to Required, they are going to get this message right here. A value is required. Well, you're free to customize that. So, what I am going to do is I am going to leave the word required in there. I am going to remove "A value is" and I am going to put brackets on either side of the word required, just like that. So now, when it reads required, it will have those little brackets around it and it's just a little bit more of a subtle message if you will. Now, I am going to be honest with you. Sometimes those can be hard to change.
Now, next we need a password. So, I am going to go up to my Validation widgets and I am going to find the Spry Validation Password. It is the third item from the right, right there. I am going to click on that and once again we are going to give this an ID and this one is going to be pwd and the label is going to be password and the Tab Index for this one is going to be 80. Well, now that we have sort of seen how this works, they can be pretty quick to set up. I am just going to click the text field, use the Properties Inspector to give it the text Class so that it gets the same width, and then click the blue tab so that I can set my individual properties for this Spry widget.
Now here we are going to have some requirements. Each password has to be at least six characters long, so I am going to type in a minimum character of 6. You can see that triggers the message, minimum number of characters not met. I am going to go through my messages in order. I am going to grab the Previous states and hit Required. I am going to do the exact same thing. I am just going to highlight that. Type in a bracket. Type in a bracket on the either side of that. Click on the tab again. This time I am going to choose Minimum number of characters not met. I am going to highlight that and I'm going to change that to must be at least six characters.
So, you can get as descriptive with this as you want. Again, I am going to put those brackets in there. It's just my kind of way of visually formatting this to be a little bit different. You don't have to use those. I am just using them from a purely decorative standpoint. Now next, I'm going to preview the Valid state. It just happens to be a nice green checkbox, but of course, you can change that as well if you want to. Okay, so everything is looking good there. Finally, I am going to validate that on Blur and Change as well and then save the file. Now, as soon as I save this file, I want to point out to you what's going to happen here.
So as we get towards the close of this particular movie, I am going to show you how to control where those go with a little bit greater detail. So, I am going to go ahead and click OK and I actually see there is my SpryAssets folder right there. Now Dreamweaver may come up and tell you that there is a syntax error. That is typically incorrect. It's just kind of a little bug that I don't think they've worked out quite yet. So, if you see that in your version, don't worry about it. Everything is okay. I am going to click right out beside my Spry Validation widget, hit Return to go down to the next line, and the last validation widget we are going to put on there is a Spry Validation Confirm.
If somebody is going to type in a password, they can't see what they are typing in. So, you want to make sure that they didn't make a misspelling or something that's going to cause them not to be able to log into your site. So, I am going to click right here on the Spry Validation Confirm widget. The ID for this one is going to be confirm, the label for this one is going to be Confirm Password, and the Tab Index for that is going to be 90. Once again, we are going to use some very similar things here. I am going to click on the text field and using the pulldown menu from my Properties Inspector, I am going to assign the text Class to it.
And then clicking on the blue tab for the Spry Confirm widget, I am going to make sure it's validating against the password. It picks up on that automatically, but you might want to just verify that and make sure that it is. For my preview states, I am going to go down to Required. Again, I'm just going to do the same thing I've been doing. Let's surround that in brackets and get rid of any of the other punctuation. And then finally, go down to the invalid and instead of saying the values don't match, I am just going to type in bracket, mismatch, please try again. I always like being polite, at least most of the time. There we go! And I am going to invalidate that on Blur and on Change as well.
Now, I am going to do a Save All and you will notice it's going to add even more. So, each one of these Spry widgets have their own set of files that's just going to copy over. So, you could wait until you have added all these and just add them all at once or you could it like we have done it here, which is to do it incrementally. Now, one last thing, guys. We are almost ready to test this, but you'll notice that the default styling for this, sort of a red text with a red box surround it, doesn't really match our site. Well, that's okay. The CSS is being driven by these external pages up here, but that's not to say that we can't change them. So here's what we're going to do.
I want you to take each one of these and click on the tab for the validation widget and choose one of the required states. It doesn't matter which one. Just choose one of the required states. There we go! We are going to go ahead and style these guys all individually by using the Code Navigator and it's the easiest way to find the targeted selectors that we need. So, I am going to hold down my Alt key and click on this text. On the Mac you would want to hold down the Command option and we're looking not in our CSS. We're looking in Dreamweaver's CSS.
If we thought our CSS is complicated, look at that. We are going to find these really long group selectors and you want to click on that and soon as you do, it will jump you into Code View and these guys are just kind of stacked one on top of each other. We are just going to change the color. I am going to change it from the CCC to 51341a. That's thatbrown color. And then for border, I am just going to change that to none. I have got my brackets. I really don't need that border. I am going to scroll through this code and see if that appears anywhere else, that display in-line color and border. It doesn't.
So, we are good in this one. All right, we'll do a Save All. I am going to do the exact same thing again. I am going to go right over here. I am going to hold down my Alt key and click, that would Command+Option on the Mac, find which of those guys has the display color and border properties and click. It will jump me right to that spot, and all I have got to do is type in that color value. Again, if I was smart, I would have copied it. 51341a and border of none. Here we go! I will again look through this to make sure that we didn't miss anybody.
I think we're okay. We'll do a Save All and we are going to finish it up by going right here and doing it again. So, trigger your Code Navigator, find the one with the display color and border properties, and just switch those out. So, the brown color for that red color. It's 51341a and a border of none. So, when you're working with any of these Spry objects, the validation widgets included, don't be nervous about going in and changing their CSS.
That's why they made these, so that you could go in there and style them the way you wanted them to look. So, just because there is a default look to something, it doesn't mean that you have to be tied to that. So again, go ahead and do a Save All and then let's preview that in a browser and see how that works. So, if I go down to this area of the form, if I click in User Name, I'll just hit Tab to ignore it. You'll notice that my browser is now telling me this is required. As soon as I type in a password, it tells me it has to be at least six characters, so I can do that. And then if these values don't match, it's going to let me know they don't match and I just get to keep trying it. So, cool! Also notice that the focus on these is exactly the same color, that sort of cream color, so we have got a lot of consistent styling throughout our form, which is exactly what we want.
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.