Hi, Rather than trying to determine the type afterwards, you can actually specify in your form tag that name is to be treated as a list. Use: <select name="name:list" multiple> and Zope will coerce the input into a list. See the excellent How-To on form variable types: http://www.zope.org/Members/Zen/howto/FormVariableTypes hth, -- Marcus
-----Original Message----- From: Allen Wallis [mailto:allen@rrsg.ee.uct.ac.za] Sent: 03 April 2000 14:09 To: zope@zope.org Subject: [Zope] finding the type of an object
Hi, I need to test the type of an object for the following reason: I have a form, one of the inputs being a <SELECT NAME="name" MULTIPLE> etc.
Now, when there are more than one item selected in this <SELECT> list, then the variable <dtml-var name> is a list (think) which can be used in a <dtml-in name> </dtml-in> iteration. The problem is if the user selects one item, then the variable "name" is a string, containing the one item that was selected. The problem is that if one simply does a <dtml-in name> iteration without checking the type of the variable "name", then the method will fail when the user only selects one item from the list. Hence I need to know the type of the variable "name". How do I find this out? Is it possible to call the python function type() from within a dtml method? If not, how else does one handle this situation?
thanks Allen
_______________________________________________ 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 )