NS6+ IE5+ Opera 7+
Form Dependency Manager
Updated: 22/09/06. Added "EMPTY" keyword. Script no longer tramples over existing events on the form elements.
An overview of this script:
Demo: Make your selections:
Step 1: Add the below code to the <HEAD> section of your page:
The above code references an external .js file, which you need to download: FormManager.js (right click, and select "Save As").
Step 2: Then, add the below sample form to your page:
This is an example web hosting signup form. It offers options of Windows or Linux hosting. If Windows, the client can choose Apache or IIS, and optional frequent crashes. If the client decides that s/he wants IIS, s/he has the option of ASP, and insecurity. The alternative is Apache, which is also available on Linux, as is SSH access. Obviously, the client cannot choose two webserver packages. It also gives an example of how to hide text using a label and hidden form element, and how to depend on a variable-value element.
The script uses a simple syntax to implement dependency amongst form fields, by utilising the class attribute. There are two basic types of statements:
DEPENDS ON name [BEING value] [OR name [BEING value]] CONFLICTS WITH name [BEING value]
Multiple statements can be separated with the