> How do you differentiate between the seq-items of nested dtml-ins?
> I tried the following code:
> <dtml-in "instances.objectValues(['Coupon ZClass'])">
> <dtml-in SearchCategory>
>    <dtml-if "_['sequence-item']=='Auto' ">
>     <dtml-call "resultsList.append(_['sequence-item'])">
>    </dtml-if>
> </dtml-in end SearchCategory>
> </dtml-in end instances>
> Where:
> instances is a folder containing the coupon instances
> Coupon ZClass is the meta type of the zclass
> SearchCategory is a list from a form
> resultsList is a list containing instances of Coupon ZClass matching the
> search criteria
> Auto is a property of Coupon ZClass
> When I try to run a search an error page pops up saying "strings aren't
> allowed as input in the in tag."
> The property Category of the zclass is the type lines.  "Auto' is one of
> the values in Category.
> In <dtml-if "_['sequence-item']=='Auto' "> I am comparing the current
> element of SearchCategory to one of the values in Category.

Your code to deal with SearchCategory looks OK to my.  Try a couple of

 * Try dumping the REQUEST variable (e.g., '<dtml-var REQUEST>' in your
   form handler) and make sure that the SearchCategory is actally a

 * Make sure you leverage the ZPublisher marshalling machinery to force
   SearchCategory to be converted to a list, even if the user selects
   only one item, e.g.::

     <select name="SearchCategory:list" multiple>
   on your form.

> In <dtml-call resultsList...> I want to append the instance and not
> SearchCategory list.

For the moment, you need to alias the "outer" sequence item, because
the "inner" one hides it (by that name). So, in your case::

 <dtml-in "instances.objectValues(['Coupon ZClass'])">

 <dtml-let coupon=sequence-item> <!-- aliasing -->

 <dtml-in SearchCategory>
    <dtml-if "_['sequence-item']=='Auto' ">
     <dtml-call "resultsList.append(coupon)">
 </dtml-in end SearchCategory>
 </dtml-in end instances>

Real Soon Now, you will be able to declare the alias for the sequence
variable within the <dtml-in> tag itself, which would solve your
problem nicely.  For the details, see:


Hope this helps!

Tres Seaver                            [EMAIL PROTECTED]
Digital Creations    "Zope Dealers"    http://www.zope.org

Zope maillist  -  [EMAIL PROTECTED]
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-dev )

Reply via email to