[Zope] Checkbox Help
Dieter Maurer
dieter@handshake.de
Sat, 11 Aug 2001 00:14:24 +0200 (CEST)
Todd Loomis writes:
> I have a set of check boxes that can be checked if the person is a member.
> My problem is if I pick more than one membership nothing goes into the
> database. So when bring the record up to view or edit I get no boxes
> checked even if they should be, here's my codes:
>
> Form:
> <input type="checkbox" name="membership" value="D"> DMSO
> ....
> <input type="checkbox" name="membership" value="I"> MSTWG
>
> SQL:
> <dtml-var membership type="string">
You should add a ":list" suffix to the form control name
"membership". This will ensure that you will get a list,
when the user checked at least one checkbox.
You still need to handle the case that the user did not
check any box. You could use:
<dtml-unless membership><dtml-call "REQUEST.set('membership',_.None)"></dtml-unless>
If you keep your code, your membership entries will have the form:
['D', 'A', ... ]
Not sure, whether you want that in the database?
I would not expect this.
Dieter