[Zope] Checkbox Help

Tino Wildenhain tino@wildenhain.de
Fri, 10 Aug 2001 18:25:14 +0200


Hi Todd,

as a service, Zope gives you a list if more then one
value of the same name exist in a form.

For what python types and especially lists are please
see http://www.python.org/ -> Documentation -> Tutorial

However, if you relie on this and get only one value,
its not a list. However there are posibilities to
cast an value explicitely to a list.

If you change your form like this:

<input type="checkbox" name="membership:list" value="D"> DMSO&nbsp;&nbsp;
<input type="checkbox" name="membership:list" value="A"> AMG&nbsp;&nbsp;
<input type="checkbox" name="membership:list" value="E"> EXCIMS&nbsp;&nbsp;
<input type="checkbox" name="membership:list" value="M"> MSWG&nbsp;&nbsp;<br>
<input type="checkbox" name="membership:list" value="V"> VV&amp;A TWG&nbsp;&nbsp;
<input type="checkbox" name="membership:list" value="T"> VV&amp;A TST&nbsp;&nbsp;
<input type="checkbox" name="membership:list" value="I"> MSTWG&nbsp;&nbsp;


You get always a list, no matter if there is one or any checkbox
checked. If there is no checkbox checked, you do not get anything at
all! So you might have to look for it (or use a default).

You should avoid using <dtml-var> in SQL Methods. Instead use
<dtml-sqlvar> since this quoutes correctly. Also <dtml-var ... sql_quote>
can be used. If you dont do so, you probably open a security hole.

Regards
Tino


--On Freitag, 10. August 2001 11:53 -0400 Todd Loomis <tloomis@dmso.mil> wrote:

> All:
>
> 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&nbsp;&nbsp;
> <input type="checkbox" name="membership" value="A"> AMG&nbsp;&nbsp;
> <input type="checkbox" name="membership" value="E"> EXCIMS&nbsp;&nbsp;
> <input type="checkbox" name="membership" value="M"> MSWG&nbsp;&nbsp;<br>
> <input type="checkbox" name="membership" value="V"> VV&amp;A TWG&nbsp;&nbsp;
> <input type="checkbox" name="membership" value="T"> VV&amp;A TST&nbsp;&nbsp;
> <input type="checkbox" name="membership" value="I"> MSTWG&nbsp;&nbsp;
>
> SQL:
> <dtml-var membership type="string">
>
> Todd
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Todd Loomis
> Web Developer (SAIC)
> Defense Modeling & Simulation Office
> 1901 N. Beauregard Street, Suite 500
> Alexandria, VA 22311
> Office: 703.824.3407 Fax: 703.379.3778
> tloomis@dmso.mil
>
>
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )