southprojects DHTML Form Widget - Conditional Fields

Conditional Fields

- This demo uses the winxp2 theme.
- This page demonstrates conditional fields. This feature is useful, in a form where some fields should be entered only when other fields are set to some value.
- There are two possible options:
  1. spformDisplayWhen=callbackFunction - when callbackFunction returns true - the dependant field is shown. When false - hiden.
     When the fields are hidden they don't use any space in the form.
  2. spformVisibleWhen=callbackFunction - when callbackFunction returns true - the dependant field is shown. When false - hiden.
     In this case the fields use the space even when they're hidden.
- The callback functions should be defined before creating the southprojects.Form object.

This page demonstrates how a form can conditionally display or hide fields based on the return value of a callback.
This feature is particularly useful for a form in which some fields should be filled only when other fields are set to a particular value.
The conditional fields feature is implemented by a callback associated with the spformDisplayWhen or spformVisible property. When the callback function returns true, the dependent field is displayed. When the callback returns false, the field is hidden.
If you use the spformDisplayWhen property, hidden fields do not use any space in the form. If you use spformVisibleWhen, fields always use the space, even when they are hidden.
Define the callback functions before creating the southprojects.Form object.

Show personal info (using spformDisplayWhen)

Personal information Name
Address
Date of Birth
Date of Birth(d.m.y)
Zip
US Phone
Credit card number
Resume

Show online info (using spformVisibleWhen property)

Online Information Email
Alternate Email
URL