[Zope] <!--#in string or list--> problem

Jim Fulton jim@digicool.com
Fri, 14 May 1999 11:54:08 -0400


Philip Aylesworth wrote:
> 
> I am having a problem with a form that has check boxes on it. If several
> checkboxes are checked it works great. If only one is checked then it
> gives the following error:
> 
>   Traceback (innermost last):
> File lib/python/OFS/DTMLMethod.py, line 151, in __call__
>   (Object: editmanystatus.dtml)
> File lib/python/DocumentTemplate/DT_String.py, line 513, in __call__
>   (Object: editmanystatus.dtml)
> File lib/python/DocumentTemplate/DT_In.py, line 628, in renderwob
>   (Object: nums)
> InError: Strings are not allowed as input to the in tag.
> 
> I can see that it is because instead of a list it now has a single
> string but I don't know how to handle this. Is there a way to force an
> object to be a list whether it is a list or a single string?

Yes.  In your form, give the name a :list suffix:

  <input type=checkbox name="nums:list">

This forces creation of a list even if there is only one value.

Jim

--
Jim Fulton           mailto:jim@digicool.com   Python Powered!        
Technical Director   (888) 344-4332            http://www.python.org  
Digital Creations    http://www.digicool.com   http://www.zope.org    

Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email
address may not be added to any commercial mail list with out my
permission.  Violation of my privacy with advertising or SPAM will
result in a suit for a MINIMUM of $500 damages/incident, $1500 for
repeats.