Fox Calculator

Summary: A simple calculator using a Fox form and calc markup expression Version: 2008-02-13 Prerequisites: PmWiki 2.2.0, Fox Status: new Maintainer: HansB? Categories: Fox


A simple calculator using a Fox form and calc markup expression.

Copy and paste markup code to your wiki page. Add the calc markup expression definition to config.php (copy and paste from Cookbook:MarkupExpressionSamples)

Use: Enter math expression in field and press Calculate button.

(:fox cfrm1 foxaction=display:)
(:foxtemplate "{$$(calc '{$$arg1}')}":)
Enter math expression:
(:input text arg1:) (:input submit post Calculate:)
(:foxend cfrm1:)
(:foxdisplay cfrm1:)

An alternative which writes (and overwrites) the result into the page:

(:fox cfrm2 foxaction=replace put=overwrite target=#res2:)
(:foxtemplate "{$$(calc '{$$arg2}')}":)
Enter math expression:
(:input text arg2:) (:input submit post Calculate:)
(:foxend cfrm2:)


An alternative which writes results into the page and keeps adding result lines , till deleted with an 'Clear Results' button:

(:fox cfrm3 put=top target=#res3:)
(:foxtemplate "->{$$arg3} = {$$(calc '{$$arg3}')}":)
Enter math expression:
(:input text arg3:) (:input submit post Calculate:)
(:foxend cfrm3:)

(:fox cfrm4 foxaction=replace put=overwrite target=#res3:)
(:foxtemplate " ":)
(:input submit post 'Clear Results':)
(:foxend cfrm4:)