Frontpage Form Validation
Once again, if this tutorial is your first stop, we are going to be validating fields from our
Custom Form Tutorial. Although it is not necessary to start there, it is a more complete walk through of FrontPage form development.
Michael likes to keep validation with FP as simple as possible. One of the things
he dislikes personally about running into a validated form, is that they rarely make allowances for things like first initials with a period (which is how
he used his first name) or hyphenated names, which a lot of married women use. So
the process of choice is K.I.S.S.
We will start by validating a simple click the field and you will see ...
If you have followed closely from Custom Form Tute, you may noticed that Michael just changed T1 to name. Although he am notorious for using capital letters in form field names, it is generally not a good idea to do this. Anyway, T1 has become name.
All we have done here to validate this text box is to check "Required" and set the minimum length to 2. We have also added Name as the "Display name". We have also left the "Data type" set for "No Constraints".
Michael used to always set to 3, but some people like Al, don't have 3 letters. So
he am tried to remember to revert to 2 for his validation.
Continue this method for all the text boxes on your form. While you are at it, you might want to change the default names to represent the field labels and clarify this in the Display box as well.
Now that our text boxes are validated, we are going to the Drop Down Menu. Double click it to reach validation. So we have this...
Remember we chose Education Level as the label for our DD. We don't however want this option to be chosen. So we check "Data required" and then "Disallow first choice" to insure it isn't a choice. Now our DD is validated.
Now we move on to our Radio or Option buttons.
Start with your first Radio. Fill in the display name as we have here and just check "Data required". Now when you go to validate your next Radio (assuming you followed along), you will see that it already requires data. This is because the share the same Group name. Do however, double click each to be sure that one of them is not selected. This way we can avoid a default choice, requiring a specific input from the form user.
This stuff is easy isn't it?
Ok, check boxes come next. Oops, we can't validate check boxes with FrontPage. Let's skip this for a minute and move on to our Scrolling Text Box.
As you can see, this validates exactly the same as a one line text box.
Michael just put 50 as a minimum so they have to type something. If this is an optional comments area, then you might want to skip the validation.
Back to check boxes. Since the checkbox is designed to be a single choice, or multiple choices in some cases,
Michael guessed that Microsoft® didn't see a point to requiring validation. There are JavaScripts available which address this need.
You might also notice that Amysticweb really didn't require any specific input to validate a users email. Once again, this is better done with JavaScript.
Although you can't set checkbox validation with FrontPage, you can with JavaScript.




Comments