Forums / Developer / How to Add A Button to a Form that does a calculation

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

eZ debug

Timing: Jan 18 2025 04:31:51
Script start
Timing: Jan 18 2025 04:31:51
Module start 'content'
Timing: Jan 18 2025 04:31:51
Module end 'content'
Timing: Jan 18 2025 04:31:51
Script end

Main resources:

Total runtime0.1712 sec
Peak memory usage2,048.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0063 587.8594180.8125
Module start 'content' 0.00630.0055 768.671997.9297
Module end 'content' 0.01190.1593 866.6016526.6250
Script end 0.1712  1,393.2266 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00392.2679200.0002
Check MTime0.00140.8363200.0001
Mysql Total
Database connection0.00080.476110.0008
Mysqli_queries0.126173.66321410.0009
Looping result0.00140.79981390.0000
Template Total0.158992.810.1589
Template load0.00090.552010.0009
Template processing0.158092.262910.1580
Override
Cache load0.00070.382610.0007
Sytem overhead
Fetch class attribute can translate value0.00120.696310.0012
XML
Image XML parsing0.00040.208510.0004
General
dbfile0.00140.8467200.0001
String conversion0.00000.003530.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs