[Zope] Multiple selection property as list

Dieter Maurer dieter@handshake.de
Wed, 14 Mar 2001 19:16:39 +0100 (CET)


Joh Johannsen writes:
 > Actually if by "Multipel selection property" you mean checkboxes on a
 > form, if you check only one, you get a string.  If you check more than
 > one, you get a list.
 > 
 > This is what I do to detect that (but I'll bet someone knows a better
 > way!)
 > ....
There is an easier way:

  append a ":list" suffix to your form variable name.
  This will ensure that you get a list, if at least one
  checkbox is checked.

You will still get nothing, when none of the checkboxes is
checked. You can use something like:

	 <dtml-unless "REQUEST.form['my_checkbox']">
	   <dtml-call "REQUEST.form.update({'my_checkbox':()})">
	 </dtml-unless>

to handle this case.

More on issues like that in

  URL:http://www.dieter.handshake.de/pyprojects/zope/book/chap3.html



Dieter