Aaron Payne <aaron@aaronpayne.com>
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 things: * Try dumping the REQUEST variable (e.g., '<dtml-var REQUEST>' in your form handler) and make sure that the SearchCategory is actally a list. * 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-if> </dtml-in end SearchCategory> </dtml-let> </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: http://www.zope.org/Members/4am/DTMLWiki/NamedDTMLInLoop Hope this helps! Tres. -- =========================================================== Tres Seaver tseaver@digicool.com Digital Creations "Zope Dealers" http://www.zope.org