InterWidgetCommunication
Inter-widget communication in Zope3 forms
Status
Created: 23/04/05 by MarkShuttleworth
Priority: HighPriority
People: StuartBishopLead, BradollenbachSecond
Contributors: MarkShuttleworth
Interested: JamesHenstridge, MatthewPaulThomas
Status: BrainDump, UduBof, LaunchpadSpecification, MatthewPaulThomasQueue
Branch:
Malone Bug:
Packages:
Depends:
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.
Introduction
Launchpad is a complex application with a large database. Many of its forms will need
XXX
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.
Rationale
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.
XXX
Assumptions
It would be nice if it was still possible to use Launchpad without JavaScript, though JavaScript support can make the experience much nicer. (This is the approach followed by Bugzilla.) The same applies to XML-HTTP: use it if it's present, fall back gracefully if it's not.
Use cases
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
XXX
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.
If your browser supports JavaScript but not XML-HTTP
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.
If your browser doesn't support JavaScript at all
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.
Activating/deactivating controls
XXX
Implementation
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.
XXX
http://php-mysql-perl.com/scripts/javascript/navigation/trees/s306404-jstree.html
Outstanding issues
- Can we avoid using the ILaunchBag? ... Why should we?
UbuntuDownUnder/BOFs/InterWidgetCommunication (last edited 2008-08-06 16:29:03 by localhost)