Creating a "list of strings" from DTML-Method?
I'm working on a product where I want to create a property that is a selection and allows you to select between a list of folders created in the parent folder. When you add a property in the property sheet the text directly above says: | |For "selection" and "multiple selection" properties enter the name of |a selection variable |in the "Value" field. The selection variable is |a property or method that returns a list of strings from which the |selection(s) can be chosen. | After fiddling around a bit I realized that the only methods that qualify are Z SQL methods. That's not what I'm looking for. Does anybody know how to do this with a DTML method or has anyone subclassed the DTML method to a class that returns a list of strings instead of rendering the text? Soren Roug European Environment Agency
Hi, Soren You might want put the following in a new dtml method and see if it does what you need: <dtml-call "REQUEST.set('folderlist', objectIds('Folder'))"> <dtml-return folderlist> Or you might make the list like so: <dtml-call "REQUEST.set('folderlist', ['folder1', 'folder2', 'folder3'])"> <dtml-return folderlist> IIRC, dtml-return is relatively new to zope, so if it does not work, you may need to upgrade. Regards, -- Jim Washington Soren Roug wrote:
I'm working on a product where I want to create a property that is a selection and allows you to select between a list of folders created in the parent folder.
When you add a property in the property sheet the text directly above says: | |For "selection" and "multiple selection" properties enter the name of |a selection variable |in the "Value" field. The selection variable is |a property or method that returns a list of strings from which the |selection(s) can be chosen. | After fiddling around a bit I realized that the only methods that qualify are Z SQL methods. That's not what I'm looking for. Does anybody know how to do this with a DTML method or has anyone subclassed the DTML method to a class that returns a list of strings instead of rendering the text?
Soren Roug European Environment Agency
This is great! It works! Jim Washington wrote:
Hi, Soren
You might want put the following in a new dtml method and see if it does what you need:
<dtml-call "REQUEST.set('folderlist', objectIds('Folder'))"> <dtml-return folderlist>
Or you might make the list like so:
<dtml-call "REQUEST.set('folderlist', ['folder1', 'folder2', 'folder3'])"> <dtml-return folderlist>
IIRC, dtml-return is relatively new to zope, so if it does not work, you may need to upgrade.
Regards,
-- Best Regards Soren Roug
participants (2)
-
Jim Washington -
Soren Roug