[Zope] Empty List Object
Jim Fulton
jim@digicool.com
Mon, 09 Aug 1999 12:13:17 -0400
wombat_harness@hotmail.com wrote:
>
> hi all,
>
> does anyone know how to check if a list object is empty. Using the
> following code i am getting an error, any thoughts:
>
> [FORM SIDE OF CODE]
>
> <TD><INPUT TYPE="checkbox" NAME="delete:list" VALUE="<!--#var
> product_id-->"></TD>
>
> [FORM PROCESSING SIDE]
>
> <!--#in delete-->
> <!--#var sequence-item-->
> <!--#else-->
> Sorry, no deletions
> <!--#/in-->
>
> So, what am i doing wrong?
An unfortunate feature of HTML checkboxes is that
unchecked checkboxes aren't included in the form, so
in your case, you don't have an empty list. You don't have a list
at all. Fortunately, the if tag can deal with this:
<!--#if delete-->
<!--#in delete-->
<!--#var sequence-item-->
<!--#/in-->
<!--#else-->
Sorry, no deletions
<!--#/if-->
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.