Adding custom validation
Viewers: in countries Watching now:
Forms perform an essential function in modern websites, making it possible to gather information from users and validate that information. In this course, Adobe Certified Expert Candyce Mairs shows how to create forms to email user information and validate user data using various methods of form validation. These validation methods include client-side, server-side, and custom validation; CAPTCHA images; and Spry validation fields. You'll also see how to set up a PHP testing environment and preview PHP pages in Dreamweaver. Along the way you'll build your skills in areas like using admin consoles, commenting code, working with variables and includes, and much more.
- Installing XAMPP on a Windows system
- Installing MAMP on a Mac system
- Using admin consoles
- Creating PHP pages
- Commenting code
- Working with web forms
- Adding custom validation
- Using redirects
- Dealing with email issues
Adding custom validation
Now, it says please enter an email address. If I put two characters or so in the email address, it says, please enter a valid email address. Now, this piece is not specifically testing and being real picky about the e-mail address. As I said, this is a topic that we could talk about for a long time, this is very simple. It's testing the number of characters in the email address, so I'll put in a correct email address. Let's put example in here.
Now, the first thing that's going to happen, is this is our form this is the name field on the form. In other words, that text box called name, where the user would put in their name. This is what represents whatever the user typed in to that box. And we're going to test the length of whatever the user put into that box. If its less than 1 meaning if it's 0, they didn't enter anything in that box. We're going to get a message that says please enter your name.
Once that box pops up and the user clicks Okay, it's going to put the users cursor back in that name field and let our form know do not submit, return false, don't submit the form. This next one is simply testing to see if there's an empty inside that same value area. So these are almost double checking one another, please enter your name. Focus goes back in the name field. Now, we have a similar thing going on that we just looked at with the email. So, it's going to test and see if it's empty.
If so, we're going to get a, please enter an email address. This is going to test for how many characters are in the box. And this is the one where we got, please enter a valid email address, because I put less than 5 characters into the form field for email. So, this is the email address and that's all we have set up on our form. The comments area is not going to be required. If we wanted it to be required, we could use these same if statements.
There are currently no FAQs about Dynamic Dreamweaver Websites: Creating and Validating Forms.