[Zope-DB] inserting data from multiple selection drop down in toMysql

info/caseviewer info at caseviewer.com
Mon Aug 11 08:55:58 EDT 2003


Thanks, Neil...I removed the leading comma and it seems to seems to
work, i.e., I can at least insert the values.

Btw - I'm storing the values as a string because values like 1 2 3 or
even 1,2,3 - which is what they will be once the individual values are
concatenated and stored in a single field - are strings rather than an
integers.

Thanks again for the help. Now I have to figure out how to extract the
stored result and split it into the original individual values...

iRex
-----Original Message-----
From: Smith, Neil (Worcester) [mailto:Neil.Smith at npower.com] 
Sent: Monday, August 11, 2003 8:13 AM
To: 'info at caseviewer.com'
Subject: RE: [Zope-DB] inserting data from multiple selection drop down
in toMysql

The code you've put there looks OK, except that there's a space which
shouldn't be there when naming the SELECT:

  <select NAME=state_id :list multiple>

  should be

  <select NAME=state_id:list multiple>

A couple of observations though, first you haven't got any code in to
set
the previously selected options in the SELECT to SELECTED.  If you are
using
the code in an update form you will need to have it highlight the
currently
selected states.

Second, is it right that you are storing the state_id's in a single
character string column in the t_org table?  Also you seem to have
started
the string with a comma, which seems a little odd.  Wouldn't it be
better to
have a table with a numeric column for the state_id and have multiple
rows
for the selected states?  That would be how I would do it.

Anyway, assuming you want it how you have described, try this.  Replace
the
call to your insert SQL method with something like this:

<dtml-var "insertSqlMethod(REQUEST,src__=1)" html_quote>

That will list the SQL rather than executing it.  You'll probably then
be
able to see where it is going wrong.

--
Neil








**********************************************************************
 
The information contained in this e-mail is confidential and intended
only for the use of the addressee. If the reader of this message is not
the addressee, you are hereby notified that you have received this
e-mail in error and you must not copy, disseminate, distribute, use or
take any action as a result of the information contained in it.
    
If you have received this e-mail in error, please notify
postmaster at npower.com (UK 01384 275454) and delete it immediately from
your system.
    
Neither Npower nor any of the other companies in the Innogy group from
whom this e-mail originates accept any responsibility for losses or
damage as a result of any viruses and it is your responsibility to check
attachments (if any) for viruses.
Npower Limited Registered office: Windmill Hill Business Park, Whitehill
Way, Swindon SN5 6PB. Registered in England and Wales: number 3653277.
This e-mail may be sent on behalf of a member of the Innogy group of
companies.
**********************************************************************




More information about the Zope-DB mailing list