So what you want is this...

1) Web page is displayed to client with two fields, 'a' and 'b'. 
2) Client enters value in 'a'.
3) Client enters value in 'b'.
4) Client hits 'Submit'.
5) contents of 'b' get added to contents of 'a' and stored in 'a'.
6) Form contents are submitted to form processor. 

Right?

If so, you have two options.

A) Have Zope do the calculation. 
  If Zope also happens to be supplying the form processor, just submit 
both values and
  have the form processor add them.

B) Javascript.
  If you _really_ need to do the calculation before you submit, you'll 
have to define a
  javascript function and assign it to the onSubmit attribute of your 
form. 

In this case I would suggest version "A", as processing the data would be 
much better done by the 
processing script. Sometimes you'll have to use Javascript, though, as 
Zope is purely server-side.

Monty

>>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<<

On 7/6/00, 5:47:06 PM, Peter Arvidsson <[EMAIL PROTECTED]> wrote regarding 
[Zope] Calculate values?:


> I am about to do
> <dtml-call "REQUEST.set('a', (a - b) * 15">

> The problem is that I cant get the calculation right. a and b are text
> input in my form (int's) and I want to first calculate a-b and the take
> the answer times 15 before submitting the event. How can I do that??


> _______________________________________________
> Zope maillist  -  [EMAIL PROTECTED]
> 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 )

_______________________________________________
Zope maillist  -  [EMAIL PROTECTED]
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 )

Reply via email to