[Zope] Problem: form-checkbox -> MySQL-table

Florent Guillaume fg@nuxeo.com
Tue, 23 Jul 2002 11:33:49 +0000 (UTC)


Richard Wesley  <hawkfish@electricfish.com> wrote:
> At 1:35 PM +0200 7/22/02, Thomas Weholt wrote:
> >I got a MySQL-table with lots of "boolean"-values, in the form of
> >ENUM('Y',N'). In my webpage I got a bunch of checkboxes and I want to map
> >the checkboxes to the fields in the table. The problem is that a
> >checkbox-value is only available if the checkbox has been checked. I've
> >tried using <dtml-if fieldname> in my sql to check for the presence of a
> >checked checkbox, add it to the columns-list and value-list if present, but
> >I get an error " Error Value : 1136, "Column count doesn't match value count
> >at row 1". That would be ok, if I could just see the SQL-statement that
> >didn't work.
> >
> >In short : how can I post a bunch of boolean-like values from a form to a
> >sql-method using MySQL?
> 
> I found that putting a hidden input value above the checkbox with the 
> "off" value solved this problem for ZPT.  Won't work for multiple 
> records because the two inputs will generate two records, so it there 
> is a better ZPT method. I'd like to hear about it.
> Sincerely,

Use <input type="hidden" name="fieldname:default" value="1">

Florent

-- 
Florent Guillaume, Nuxeo (Paris, France)
+33 1 40 33 79 87  http://nuxeo.com  mailto:fg@nuxeo.com