I need to do some calculation in the form that will change a final amount depending of what the user select in the form.
I’m not sure How?
Hi Chacapamac,
You can do calculations in the browser using custom JavaScript in a Load JavaScript action in the On Load event and/or using PHP in a Custom Code element in the On Submit event of your form. For important calculations they should be confirmed with PHP even if they have been calculated in the browser as it is possible to hack them there.
Bob
I’m not really proficient with php. Do you know a web site or online tool that can help?
The calculation I have to do should be relatively simple. This is for a form for a holiday reservation.
If you take this or that extra the base amount for a trip will reflect those extra. Do you think I should “Confirmed with PHP” and what is “Confirmed with PHP”
Hi Chacapamac,
You may need help from someone with more coding experience.
If you do calculations in the browser using JavaScript they are very user-friendly - but they could be altered by someone who hacked your form so you should double-check the calculation using PHP after the form submits. PHP is the language used on the server.
Bob
Well. I’m a pretty fast learner with code.
I find a (I think) good start on Javascript Calculation here —>http://www.javascript-coder.com/javascript-form/javascript-calculator-script.phtml
Do you have a simple example or documentation for how to perform calculation with Chronoform. If I understand the principle, I should be able to do it.
Also, If you can provide a simple example or documentation, how to “double check” with PHP with Chronoform ?
Hi Chacapamac,
Please try searching here on calculation for some examples. You'll find some, I don't often give code examples for calculation because each one is different and so the answers aren't particularly helpful to other users.
A double check in PHP means doing the same calculation after the form submits and checking that the results are the same.
Bob
Chacapamac,
Where did you find your examples? I am in the exact same situation.
Thank you.