Home
Form effects
Here
|
Categories
Other Sections
Sweet Ads
Compatibility
|
|
NS6+ IE5+ Opera 7+
Form Dependency Manager Author:
Twey |
Help forum
Updated: 22/09/06. Added "EMPTY" keyword. Script no longer tramples over existing events on the form elements. Description: This is a form dependency script for shuttling the display of fields within a complex form, where the visibility of a form field should depend on the value and/or state of another. It's not meant to replace server side scripting for dictating what fields get filled out by the user; after all, JavaScript can easily be manually disabled by the user. An overview of this script:
Demo: Make your selections: Directions: 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. More infoThe 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 |