At 23:18 2003-05-25 -0600, Norman Lorrain wrote:
I'm trying to submit multi-checkbox (Formulator widget) values to a database using ZSQL.
My database schema defines the fields as boolean; Formulator converts the values to a list of checked items, e.g. ['checked_item_one', 'checked_item_two']. Only checked items are added to the list.
How can I map the formulator output to proper SQL? (a list of booleans) I have a couple of ideas, but I'm new to Zope and not sure what would be best, or even possible.
Maybe you've found a solution to this already. Since with checkboxes, non-existances == false. This is not always good so you'll have to provide some more details. I usually do something like this: <input type="checkbox" name="ids:list" value="abc123"> <input type="hidden" name="askedfor_ids:list" value="abc123"> Then in a Python Script I get a list of possible answers and a list of answers. By comparing them, I can tall which ones were set to false (i.e. unticked) Don't go directly from DTML to a SQL Method. Bad practise. Get the habit of always controlling the flow with Python Scripts. Peter
Thanks
Norman Lorrain
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )