Inter-widget communication in Zope3 forms
Created: 23/04/05 by MarkShuttleworth
UduSessions: 4 (2 discussions, 2 drafting)
NB. Two session skipped so far - UI use cases were done in the first session and I need to discuss Z3 plumbing with Brad and maybe SteveA.
Launchpad is a complex application with a large database. Many of its forms will need
This spec describes a strategy to allow for "inter-widget communication" on forms autogenerated in Zope3. This will allow for one widget to be updated by a change made in a second widget. For example, if on a page one is selecting the product series associated with a feature, it would be nice to do it as *two* widgets, one to select the product (probably a Google-Suggests style widget) and a second to select the series (probably a dropdown listbox). When the product is changed, it would be necessary to reset the product series listbox to include the relevant series for that product.
Many of our Launchpad pages include a set of widgets which are related. This spec describes a way to make those forms feel more intelligent than they currently do.
There are two use cases for this communication.
- Providing a secondary list based on the value chosen in a primary list. (For example, choosing a source package then being presented with a list of binary packages.)
- Activating/deactivating controls dependent on values of other controls. (Those other controls will often be checkboxes, but not always.)
Primary and secondary lists
If your browser supports XML-HTTP
Selecting an item in the primary list will send a request to the server, with the response containing the contents and default selection (if any) specified for the secondary list.
Choosing an item in the primary list will submit the whole form, in such a way that it is reloaded with the secondary list updated and default selection (if any) specified for the secondary list.
The secondary list will have an "Update List" button underneath. This button will submit the whole form and update all the secondary list. The reload will automatically scroll to the top of the secondary list.
The Zope3 schema will be extended with a Launchpad-specific form validation.
This form validation will be able to:
- turn a control on or off
- populate a control with a given list
- set the default value of a newly-populated list.
- Can we avoid using the ILaunchBag? ... Why should we?