[Zope] Expression Evaluation Problem (Newbee Question)

Sam Gendler sgendler@impossible.com
Sun, 30 Jan 2000 04:19:30 -0800


Assuming you have <input type="checkbox" value="1" name="xtype">, then your if
statement needs to be <dtml-if "xtype=='1'"> (note the extra single quotes),
which does a string comparison.  Otherwise, you are comparing the ascii code of
'1' with the ascii code, 1.  They don't match.  Alternatively, you could put
<input type=checkbox value="1" name="xtype:int">, which will force the form
field to be cast into an int.  Or else you could have <dtml-if
"_.int(xtype)==1">, which explicitly does the cast for you.

--sam

Borno Janekovic wrote:

> Hi,
>
> I'm not realy new into Zope but suddenly found a strange question. I'm not
>
> shure where the problem is:
>
> - on a form a user can choose a checkbox and the value is stored into
> xtype
> - in the next document I can access the value of xtype with <dtml-var
> xtype>
>   the correct value is printed out.
> - but if I do a check like
>    <dtml-if "xtype ==1"> I get no matching.
>
> What am I doing wrong?
>
> Thanks
>
> Borno
>
> --
> Sent through Global Message Exchange - http://www.gmx.net
>
> _______________________________________________
> 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 )

--
Sam Gendler
Chief Technology Officer - Impossible, Inc.
1222 State St. Suite 250
Santa Barbara CA. 93101
w: 805-560-0508
f: 805-560-0608
c: 805-689-1191
e: sgendler@impossible.com