I guess i did something wrong on this, so it's not work? <dtml-if expr="objectValues('newclient')==''"> <br> Null <dtml-else> <br> Not Null </dtml-if> My idea is to test if Zobject-newclient exist in this folder or not. But i always get "Not Null" even tho I'm sure there is no newclient exist in the folder. Can someone help me to fix this? Thanks __________________________________________________ Do You Yahoo!? Get personalized email addresses from Yahoo! Mail http://personal.mail.yahoo.com/
Oops Oops wrote:
I guess i did something wrong on this, so it's not work?
<dtml-if expr="objectValues('newclient')==''"> <br> Null <dtml-else> <br> Not Null </dtml-if>
My idea is to test if Zobject-newclient exist in this folder or not. But i always get "Not Null" even tho I'm sure there is no newclient exist in the folder.
Can someone help me to fix this?
Thanks
ObjectValues returns a list of objects optionally filtered by meta_type. To test for the existence of an id in a folder, the best way is probably: <dtml-if expr="'newclient' in folder.objectIds()"> ... </dtml-id> Which will return true if 'newclient' is in the list of object ids for the folder (you can omit the folder designation to refer to the current folder, however if won't work without it if you code this in a DTML document). hth, -- | Casey Duncan | Kaivo, Inc. | cduncan@kaivo.com `------------------>
Thank you Casey :) I got it work. here is the code <dtml-if expr="objectIds('tbContainer')==[]"> <dtml-var tbContainer_addForm> </dtml-if> --- Casey Duncan <cduncan@kaivo.com> wrote:
Oops Oops wrote:
I guess i did something wrong on this, so it's not work?
<dtml-if expr="objectValues('newclient')==''"> <br> Null <dtml-else> <br> Not Null </dtml-if>
My idea is to test if Zobject-newclient exist in
this
folder or not. But i always get "Not Null" even tho I'm sure there is no newclient exist in the folder.
Can someone help me to fix this?
Thanks
ObjectValues returns a list of objects optionally filtered by meta_type. To test for the existence of an id in a folder, the best way is probably:
<dtml-if expr="'newclient' in folder.objectIds()"> ... </dtml-id>
Which will return true if 'newclient' is in the list of object ids for the folder (you can omit the folder designation to refer to the current folder, however if won't work without it if you code this in a DTML document).
hth, -- | Casey Duncan | Kaivo, Inc. | cduncan@kaivo.com `------------------>
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists -
http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
__________________________________________________ Do You Yahoo!? Get personalized email addresses from Yahoo! Mail http://personal.mail.yahoo.com/
Oops Oops wrote:
Thank you Casey :)
I got it work. here is the code
<dtml-if expr="objectIds('tbContainer')==[]"> <dtml-var tbContainer_addForm> </dtml-if>
You could shorten that to: <dtml-unless expr="objectIds('tbContainer')"> ... </dtml-unless> You can get away with this because an empty list [] is considered a false value. -- | Casey Duncan | Kaivo, Inc. | cduncan@kaivo.com `------------------>
participants (2)
-
Casey Duncan -
Oops Oops