[Zope] How do I make an editable lists to fill a selection list?
Ed Corrado
ecorrado@rider.edu
Fri, 7 Apr 2000 11:59:36 -0400 (EDT)
Rik,
After re-reading my post, you are correct that I wasn't as clear as I
should have been with my original post, in part because I'm not clear how
a good way to do this is. I am not connecting to a SQL database, and at
this point do not want to. What I would like to do is have a list of
values such as: 'Art' 'Biology' 'Business' 'Chemistry'....
I would like that this list could easily be edited by someone that knows
very little about Zope, HTML, DTML, etc. I would also like that this list
be editable using a web form without the Zope mangement interface, however
if the mangement interface needs to be used (or some other editor) that is
acceptable. Once I have this list, I would like to be able to call it into
a loop to populate a set of checkboxes. Currently, I have hard-coded these
checkboxes to be populated in DTML method as follows (The "real"
application has many more options):
<dtml-in "('Art', 'Biology', 'Business', 'Chemistry')">
<input type=checkbox NAME="database_keywords" value=<dtml-var
sequence-item>><dtml-var sequence-item>
</dtml-in>
This successfully makes a list of checkboxes that one can select to be
entered into an object. This form also has a number of other text and
string fields, but at this point this is the main one I would like to be
able to not have to hard code. The main reason I don't want it hard-coded
is that if someone entering a new entry wants to add a subject on the fly,
I would like them (providing they have permission) to be able to easily do
so by going to a different screen.
What I want is that instead of having the hard-coded subject keywords, as
in my above example that they be read from a list (preferably stored in
Zope as single object (DTML Method?), or from a series of object titles in
a single folder. Basically I want to replace "('Art', 'Biology',
'Business', 'Chemistry')" in the above example with some sort of dtml call
to read these values from a list.
Ed C.
On Fri, 7 Apr 2000, Rik Hoekstra wrote:
>
>
> >I currently have a form that allows me to select a choice of keywords to
> >describe an Item that I am entering into a Zope object. (See
> >http://phoebe.rider.edu:8080/Athena/entries/entry_addForm (more
> >specifically, the Database Keywords check-boxes)). This is one of
> >about 25 fields. I am currently generating the list of selection keywords
> >using a dtml-in hard-coded loop as described in AlexR's How-to on
> >selection lists (http:www.zope.org/Members/AlexR/SelectionLists). This
> >works fine, but I would like to get this values from a list stored in
> >another object/method/file/(?) that can be edited more easily (hopefully,
> >via a web form. My question is, how should I begin to do this?
>
> Hm, the question is not entirely clear to me. You could get/store these
> values in many ways.
>
> > Besides
> >needing a way to call the list into my loop, I need to figure out how
> >/where to store the list.
>
> Using a list in dtml, you could use anything that returns a Python list or
> can be turned into a list. This includes (for example) SQL databases, Tiny
> Tables, Zcatalogs and in general anything that returns a ResultSet (if I
> remember the term correctly).
>
> Objects also have properties. Property types that return a list include
> token and lines.
> Properties can be manipulated with manage_editProperties and
> manage_changeProperties (see for a short guide the ZQR at
> http://zdp.zope.org/projects/zqr) or some of the DTML guides. If you define
> ZClasses you may do even more complicated things with propertysheets.
>
> Hard coded lists could also be returned from DTML methods residing in the
> acquisition path of an object. For example:
>
> <dtml-return expr="['a', 'b', 'c']">, but you could also imagine more
> intricate things. The same may be accomplished by PythonMethods or External
> Methods.
>
> You, see, too many possibilities. It depends on what exactly you want what
> you need. If you provide more details, we may be able to help you somewhat
> more.
>
> > Any starting points would be greatly
> >appreciated.
> >
>
>
> hth
>
> Rik
>
>