[Zope-DB] inserting data from multiple selection drop down into
info at caseviewer.com
Fri Aug 8 08:37:10 EDT 2003
I can't quite figure out how to insert selected values from a drop down
box (multiple list) into mysql. I have been able to successfully display
the records I want, but when I submit the form only a 0 value is
inserted into my db.
Here's the scenario:
1. I have 2 tables - t_org and t_state linked by a stateID field
(t_state would be the parent).
2. I have a t_org update form which contains, among other fields, a
multiple list drop down that is supposed display state names from the
3. I created a ZSQL method to basically pull the list with the
select state_name, state_id as FK_state_id
4. In my t_org update form I included the following snippet to
display the state names in a multiple selection drop down box (and it
<select NAME=state_id :list multiple>
<option value=-1> None
<option value="<dtml-var FK_state_id>"> <dtml-var
5. My org insert method includes the following line to insert the
selections made above:-
<dtml-sqlvar "','+_.string.join(state_id,',')+','" type=string> ,
6. The problem (which you may have already figured out, is that I
cannot insert any of the selected state_id values into the t_org table!
I am guessing there's something wrong with my insert syntax.Can you
vital stats: winXP, Zope 2.6.1, python 2.1
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Zope-DB