Hi!

I have a list of records that come from a database select query (dtml-in horses).

I suggest you to use Python Script to get data from DB and then
ZPT to display results (if you're using ZMI level scripting).
DTML is recomended to use only in ZSQLMethods.


You may want to use ':list' on your page with checkboxes, like:

<input type="checkbox" name="horse_ids:list" value="1">
<input type="checkbox" name="horse_ids:list" value="2"> (...)
<input type="checkbox" name="horse_ids:list" value="3"> (...)

then, on confirm page you will get 'horse_ids' from request as
a python list (notice that without :list you'll get scalar value
if only one checkbox is chosen or list when two or
more checkboxes are selected), with :list you always
have list, or None when no checkbox is chosen.

How can I get records with id 1,2,3 out of the database

table? Then can those records be saved onto a html page for use later?


On the confirm page you should store horse_ids list in session
(to be able to use this later), like:

request.SESSION.set('my_horses', horse_ids)

then you should call another ZSQLMethod with horse_ids list as parameters
to get only previously selected horses.
It should be converted to sql like:

select * from table_horses where horse_id in (1, 3, 4, 6)

You can find how to write such ZSQLMethod in Zope Book (chapter about
relational database connectivity).

Hope I understood you correctly :)

--
Maciej Wisniowski

_______________________________________________
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db

Reply via email to