[Zope] How to set selected items in multi-select list from lines property

John Schinnerer john at eco-living.net
Sun Jun 4 18:42:38 EDT 2006


Aloha,

I have an "add" form where a user can add an object.
In one part of the form, the user selects zero or more options from a 
multiple select list.
The selected options populate a lines property of the object when the 
object is added.

I also have an "edit" form where the user can later edit these same 
objects they've created. They can use the same multiple select list to 
change the selected options.
Of course the previously selected options (in the lines property) need 
to be displayed as such when they first visit the edit form.  So...

I need to know how to display the multiple-select list in the "edit" 
form so that the options currently in the lines property are set as 
selected.

I suspect there is some very slick way to do this, maybe with TAL alone...?

So far I am only coming up with what seem to be cumbersome solutions 
that have unecessary overhead (comparing a list option with every 
element in lines property via python script to see if it should be set 
selected, and repeating for every list option)...is there a better way?

Any help appreciated.

thanks,
John S.

-- 

John Schinnerer - MA, Whole Systems Design
------------------------------------------
- Eco-Living -
Whole Systems Design Services
People - Place - Learning - Integration
john at eco-living.net
http://eco-living.net


More information about the Zope mailing list