I need help with saving a select box value. When multiple items are selected in my form, and then inserted into a SQL server, it is saved as a string that looks like a list. I have tried to specify the data type in name value, none of which change the stored value in the database. This may not be a problem if I only knew how to display the list from the returned database value. _________________________________________ Here is the form object(it is generated dynamically from a dtml method so the size changes): <select name="PeopleInvolved" multiple> <option>aperson</option> <option>bperson</option> <option>cperson</option> <option>dperson</option> </select> _________________________________________ In the database field( a text data type in sql 8) it saves like so: Insert into table (PeopleInvolved) values (<dtml-sqlvar PeopleInvolved type="string">) ['aperson','bperson','cperson'] _________________________________________ When I do a select statement in a zsql method it returns the same value: select * from table ['aperson','bperson','cperson'] _________________________________________ And to display the results in html is do this: <table> <dtml-in sqlMethod> <dtml-in expr="_.string.split(PeopleInvolved)"> <tr><td><dtml-var sequence-item></td></tr> </dtml-in> </dtml-in> </table> __________________________________________ Which show like so: ['aperson', 'bperson', 'cperson'] __________________________________________ If I just use <dtml-in PeopleInvolved> I get an error about not using strings in an "in" tag. So my question is, How do I save it? OR How do I display it? Without having the brackets and quotes? Thanks for any help you have! Greg Fischer sysman@tecghroupinc.com
[Greg Fischer] [[ I need help with saving a select box value. When multiple items are selected in my form, and then inserted into a SQL server, it is saved as a string that looks like a list. I have tried to specify the data type in name value, none of which change the stored value in the database. ]] First you have to decide what should be stored in the database when the form has multiple selections. Then you have to decide how to insert that into the database. Then we can talk about how to make Zope do that, if it has not become clear by then. Cheers, Tom P
participants (2)
-
Greg Fischer -
Thomas B. Passin