I'd like to create a custom widget for the "Starbucks problem" - my
designation - where I need to set an attribute to a path of an external
tree, which is stored on LDAP or DBMS.
Basically, the content object has an attribute "store" which is a tuple
of (state, city, store_no) and I would manipulate the tuple as a single
widget, with three <select> menus.
I'm thinking of declaring it this way:
== interfaces.py ==
store = Tuple(
description=u"Store state, city and number",
required = False,
min_length = 3,
max_length = 3,
== browser/configure.py ==
label = "New MyObject"
name = "AddMyObject.html"
schema = "myapp.interfaces.IMyObject"
content_factory = "myapp.myobject.MyObject"
fields = "store"
permission = "zope.ManageContent">
<widget field="store" class=".widget.StarbucksWidget" />
== browser/widget.py ==
(dictionary of dictionaries of dictionaries) which will fill and change
the dropdown menus accordingly. As an improvement, the tree nodes can be
retrieved by XmlHttp
Before hitting my head too hard, is this doable?
re-submit itself at each menu selection? For instance, I select the
state, the form resubmits and gives me the choice of cities. How can I
tell the first two <select> tags to reload the page? Is it enough to
attach an onchange event that calls submit() ?
Zope3-users mailing list