[Zope-dev] Asking for the type of a variable

Hannu Krosing hannu@tm.ee
Wed, 10 Nov 1999 00:08:44 +0200


"David S. Harrison" wrote:
> Actually, the reason this arises is forms.  I have a series of radio
> buttons in a form.  When submitted to Zope, I notice that if one item
> is selected, the value is a string.  When many items are selected,
> the value is a list of strings.

then it's most likely a checkbox ?

>  Since <dtml-in> does not accept a
> single string as an argument, I need to test to see if the incoming
> value is a string or a list of strings before processing it.  I will
> gladly accept any better idioms for handling this case. 

set the name to myradiobutton:list , i.e

<input type=checkbox name="cb:list" value="thevalue">

or for numeric values

<input type=checkbox name="cb:list:int" value=7>

> The tests
> certainly make the DTML code more complex than I think it should be.

Sure ;)

--------------
Hannu