Breadcrumbs

Home Web Development How add a "Calculate" button to a Calculated Fields Form
How add a "Calculate" button to a Calculated Fields Form PDF Print E-mail
Written by Administrator   

 

To add a "Calculate" button to evaluate the equations,  Copy paste the following snippet of code in a comment filed in you form and your blog:


<input type="button" value="Calculate" onclick="CalcField.defaultCalc('#cp_calculatedfieldsf_pform');" />





To avoid that equation be calculated automatically, while the values of rest of fields are typed, edit the fbuilder-pro.jquery.js file, removing or commenting with /* ... */ the snippet of code:

$(document).bind('click keyup change', function(evt){
if(evt.keyCode && (evt.keyCode >= 33 && evt.keyCode <= 40)) return;
if(evt.type == 'click' && (evt.target.tagName != 'INPUT' || evt.target.type != 'RADIO' || evt.target.type != 'CHECKBOX') ) return;
obj.Calculate(evt.target);
});

 

The results of equations will always be a number not a text or string, because it is a calculated field.



You can download the Calculated Fields Form from Wordpress

For more information go to the developer site.