How to Add A Button to a Form that does a calculation

Author Message

Kevin Cook

Wednesday 23 February 2005 10:05:29 am

Please keep in mind that I am new to EzPublish, and html in general.

Though I've spent hours browsing the documentation on forms, etc, and I have yet to figure out this:

I have a class, called classified. I have figured out how to get users to submit a 'new' classified. But now I want to add a button to the form, that does a calculation. For instance I want it to count the words in some text box of the form and redisplay the cost of the ad, before the user submits the ad. Nothing fancy for now, just a button that does the calc, and re-displays the same form, but with the price having being calculated. Much like the shopping basket does when you update the quantities and it re-calculates the final price.

thanks in advance for any help you can give me.

Kevin

Wednesday 23 February 2005 11:44:38 am

Hi,

Maybe this is what you are looking for:
http://www.ez.no/ez_publish/documentation/reference/template_operators/strings/count_words

I haven't tried it...

Kevin Cook

Wednesday 23 February 2005 2:45:35 pm

Thanks for the link to that function, it will come in handy.

My promblem is more fundemental, ie what html code and template code to implement the button and the calculation. and refresh.

krc

Thursday 24 February 2005 2:11:17 am

Maybe you find some answers in the "Build an eZ Publish site" documentation :
http://ez.no/ez_publish/documentation/toc/(from)/36647

Kevin Cook

Thursday 24 February 2005 9:00:09 am

Again thanks for the link.

So far here is what I've determined, first I need to know how to add a button, that simply simply redirects itself to the page it's on.

And the page should always simply do the calculation. ie calc the words in a given text box, and display the result.

This is probably trivial to seasoned html coders and/or ez publish coders. But I am neither.

But I am pressing on. :)

thanks for the feedback, Hans-Henry

krc

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.