[Zope-DB] inserting data from multiple selection drop down into Mysql

info/caseviewer 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
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
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.zope.org/pipermail/zope-db/attachments/20030808/b0f40dda/attachment.htm


More information about the Zope-DB mailing list