With PVB Contact Form 7 Calculator, you can easily turn any Contact Form 7 form into a calculator. Calculated fields are based on user input and selections in other parts of the form. The plugin can be used for creating various types of calculators, such as an ideal weight calculator, calorie calculator, quote calculator for hotel booking, car rental quote calculator, mortgage calculator, tax calculator, finance calculators, date calculator, etc.
Features
Advanced calculations – set your custom formula based on user input, for example:
cost_per_day * days * (1 + (tax_percentage / 100))
Hide calculated fields – they can be visible to the user or not. Your choice!
Server-side calculation – you don’t have to disclose your top secret formula! Calculations are performed behind the scenes, on the server.
Calculate on button click – you can let your users trigger the calculations without submitting the form.
Calculate on submit – values are always calculated on submit, so you can use them in your notification emails.
Calculate on other events – you can also trigger calculations from another script at any time!
Correct floating-point math – PVB Contact Form 7 Calculator handles decimal floating-point math properly, unlike many online calculators that introduce rounding errors when converting to binary and back, yielding incorrect results (such as 0.6 + 0.3 = 0.8999).
Can I use PVB Contact Form 7 Calculator for currency conversion?
You can use the “wpcf7calculate” jQuery event to trigger currency conversion or other post-processing operations after a calculation. You can code your own Javascript function and place it somewhere on your website to call a third-party currency conversion API. Here is an example:
jQuery(function($) {
$('form').on('wpcf7calculate', function() {
var dollars = jQuery('input[name=total]').val();
var euro = currencyConvert(dollars, 'USD', 'EUR');
if (euro === false) {
alert('Currency conversion failed');
} else {
alert(dollars + ' dollars = ' + euro.toFixed(2) + ' euro');
}
return;
});
});
function currencyConvert(amount, from, to) {
var result = '';
var convertUrl = "https://free.currencyconverterapi.com/api/v3/convert?q=" + from + "_" + to + "&compact=ultra";
var rate = false;
jQuery.ajax({
url: convertUrl,
async: false,
type: "GET",
dataType: "json",
success: function (data) {
rate = data[from + "_" + to];
}
});
return rate ? parseFloat(amount) * parseFloat(rate) : false;
}
How does the calculator handle multiple checkbox groups?
If more than one checkbox is selected in the same group, the values will be summed. To avoid the possibility to select more than one checkbox at the same time, use the “exclusive” modifier in the checkbox tag, or use radio buttons instead. More information and examples are available in the plugin documentation.