[Zope-DB] inserting data from multiple selection drop down
intoMysql
info/caseviewer
info at caseviewer.com
Mon Aug 11 08:28:42 EDT 2003
Can somebody please help me with this issue?
Thanks.
-----Original Message-----
From: zope-db-bounces at zope.org [mailto:zope-db-bounces at zope.org] On
Behalf Of info/caseviewer
Sent: Friday, August 08, 2003 7:37 AM
To: zope-db at zope.org
Subject: [Zope-DB] inserting data from multiple selection drop down
intoMysql
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
t_state table.
3. I created a ZSQL method to basically pull the list with the
following SQL:-
select state_name, state_id as FK_state_id
from state
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
works!):-
<select NAME=state_id :list multiple>
<option value=-1> None
<dtml-in ddState>
<option value="<dtml-var FK_state_id>"> <dtml-var
state_name>
</dtml-in>
</select>
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
please help?
Thanks,
rex nedoli
vital stats: winXP, Zope 2.6.1, python 2.1
More information about the Zope-DB
mailing list