[Zope] Calculation with DTML/form

Andreas Jung Andreas Jung <andreas@andreas-jung.com>
Wed, 09 Jul 2003 11:12:32 +0200


--On Mittwoch, 9. Juli 2003 16:59 Uhr +0800 Chan YH <cyhoong@pc.jaring.my> 
wrote:

> I appreciate if someone can show me how to do calculations in DTML.
> I am having a problem with Total variable in the example below.
>
>
> Data_form
>  -----------
>  <form method="post" action="Data_validate">
>  <table>
>    <tr><td> Enter quantity: </td>
>        <td><input type="int" name="quantity" value="1" /></td>
                                  type="text"  name="quantity:int"
>    </tr>



>    <tr><td> Enter Price: </td>
>        <td><input type="int" name="price" value="1" /></td>
                                  type="text" name="price:int"

>    </tr>
>    <tr>
>        <td><input type="submit" name="submit" value="Submit" /></td>
>    </tr>
>  </table>
>
>
>  Data_validate Method
>  ----------------------
>    Price is <dtml-var price> <br />
>    Quantity is <dtml-var quantity> <br />
>
>    Total is <dtml-let expr="Total=price * quantity"></dtml-let> <br />
Total is <dtml-var "price*quantity">

-aj

P.S. I recommend  to refer to the Zope Book since your problems are
explained there.