Re: [Zope] string or list?
Curtis Maloney <curtis@umd.com.au> writes:
Greetings,
I'm having a small problem (duh! :)
In my page, a person might select a number of items from a list. The list is generated from an SQL query, and has unique IDs for each row. Fine. Simple, right?
Sure... And each row has a radiobutton input called 'done'. When the user hits submit, if they've pressed any of the radiobuttons i will get either a 'done' string (one selected) or a 'done' list (multiple selected).
Problem is.. how do i tell which? Is it possible with DTML, as i try to avoid using external methods for something so trivial.
Here's a code snippet I use: <dtml-comment> oids - If only one entry is checked, this is a string containing the value attribute, otherwise it's a list of value strings arrgs - ARRGS! rowids - List of value strings to work with </dtml-comment> <dtml-let arrgs="REQUEST.get('oids',[])" rowids="[]"> <dtml-try> <dtml-call "rowids.extend(arrgs)"> <dtml-except TypeError> <dtml-call "rowids.append(arrgs)"> </dtml-try> [...] </dtml-let> The code relies on the fact that Python's LIST.extend() method requires a list argument. HTH Siggy -- Siggy Brentrup - bsb@winnegan.de - http://www.winnegan.de/ bsb@north.de - http://www.north.de/~bsb/ ****** ceterum censeo javascriptum esse restrictam *******
participants (1)
-
Siggy Brentrup