Dreamweaver’s form validation is a simple one. While it works for about 80-85% of all cases, It doesn’t have a lot of flexibility to make changes unfortunately. Here is a list of some of the things you cannot do with Dreamweaver’s built in form validation tool.
- Check to see if a check box is selected.
- Check to see if two fields have the same value (validate password).
- Check to see if the first item in a drop down menu (list) is not selected.
- Create a custom error message.
- Provide realtime feedback.
Originally, if you wanted to do any form validation, you had to process the form with JavaScript yourself. However, several form validators have been created to simplfy the process, and keep code writting to a minimum.
However, there are several options which you can use, depending upon what solution you are seeking.
Dreamweaver Extensions
Early on, Macromedia knew that it couldn’t put all of the features into Dreamweaver, so they built it so it could be extended by other people. These extensions allow for people to modify Dreamweaver, to add their own features, like new form validators.
I personally use Yaromat, which is available on the Adobe Dreamweaver Exchange. A nice feature about this, is that it requires no knowledge of HTML or JavaScript, so it only takes a few minutes to learn.
Yaromat solves most of the situations which you might want to validate, including custom error messages, checking one value against another field, etc. However, it only checks when someone clicks on the submit button.
Custom Solutions
I wrote a form validator tool a while back, called Validator. (I know – such a simple basic name.) It requires 2 lines of JavaScript code to initialize, and then modifying the HTML tags you want to check. While it is a little more complex than Dreamweaver’s or Yaromat to set up, it also can check for almost any validation issue, and does so while the person it still in the form.
For example, you can check for valid date formats (add usdate=”usdate” as an attribute to the input tag), US style phone numbers (add usphone=”usphone” as an attribute to the input tag), and many (23 total) others. This includes some more unique validation checks, like having a minimum number and/or maximum number of or words and/or characters.
Advanced Form Validation Techniques was originally found on Access 2 Learn