Contact Form 7 Issues Tricks and Solution

How to add auto calculation fields or calculator in Contact Form 7 using Jquery

This tutorial is only for those who are trying to add calculator fields like where user will put value in one field and some calculation will be done automatically and result will be viewable in other single or multiple fields in contact form.

This technique I have shared is for advance level users who have knowledge of Jquery and using Contact form 7 . If you are new or facing problem to implement such type of fields, feel free to message me in comments section or take my personal help in my fiverr profile.

Here is the technique

1. At first put your calculator fields where you want to do or show calculation

calculator field in contact form 7

2. Use Jquery code something like this

Calculation and value show in contact form 7 field

I have shared you the Jquery auto calculation code for contact form 7 below

<script>

jQuery(document).ready(function(){
//alert("Welcome");
 var ce;
var ps;
var ar;
 

jQuery("#ce").on("change", function() {
 ce= this.value ;

ps=(((ce/30))/5)*1.2;
ar=(((ps*1000)/250)*(0.941*1.65)*1.6);
jQuery("#ps").val(ps.toFixed());
jQuery("#ar").val(ar.toFixed());

}); 


});
</script>

3. Result

Contact Form auto calculation

If you have any issue feel free to ask me question here in comments section

OR

Pay me some, I will help you for CSS Issue Personally CLICK HERE….

41 thoughts on “How to add auto calculation fields or calculator in Contact Form 7 using Jquery”

      1. Hi,
        Thank you for your reply.
        I just start it, not yet on line.
        I just need a simple form, the user enter a number in one field, and get a calculated result on the next field. It is not so simple with contact form 7.
        I have an intermediate level in wordpress and web development, I don’t do this for money, just to help a community.

        Like

  1. Dear Om,
    thanks for this good tutorial. It helps a lot to understand how CF7 works together with JS.

    But maybe you could also explain how to use checkboxes and radioboxes in that way. I think there would be two different possibilities:

    1) Calculate with the amount of checkboxes that are checked
    2) Calculate with the value of one or more checkboxes

    Would be nice if you could give us a hint how to solve these two problems.

    Thanks a lot,

    Sascha

    Like

      1. Did you recieve my answer? Because I´ve sent it but it doesn´t appear in the comments. And when I try to re-post it, it says that it is already written…

        Like

  2. I´ll show you the CF7 code…

    Wie breit soll die Anzeige werden?
    [radio_custom breite id:breite “1|1-spaltig (42,5 mm)” “2|2-spaltig (90 mm)” “3|3-spaltig (137,5 mm)” “4|4-spaltig (185 mm)”]

    Wie hoch (in mm) soll die Anzeige werden?
    [number hoehe id:hoehe min:10 max:185]

    Soll die Anzeige farbig oder schwarz-weiß erscheinen?
    [radio_custom farbe id:farbe “0.46|schwarz-weiß” “0.65|farbig”]

    Grundpreis der Anzeige (netto): [calculated grundpreis id:grundpreis “breite*hoehe*farbe”]

    In welcher Kalenderwoche soll die Anzeige erscheinen?
    [Checkbox_custom kalenderwoche id:kalenderwoche “1|01” “1|02” “1|03” “1|04” “1|05” “1|06” “1|07” “1|08” “1|09” “1|10” “1|11” “1|12” “1|13” “1|14” “1|15” “1|16” “1|17” “1|18” “1|19” “1|20” “1|21” “1|22” “1|23” “1|24” “1|25” “1|26” “1|27” “1|28” “1|29” “1|30” “1|31” “1|32” “1|33” “1|34” “1|35” “1|36” “1|37” “1|38” “1|39” “1|40” “1|41” “1|42” “1|43” “1|44” “1|45” “1|46” “1|47” “1|48” “1|49” “1|50” “1|51” “1|52”]

    Now the next calculation should be “grundpreis” multiplied by the number of checked boxes from “kalenderwoche”.
    And what would be really nice: A IF-Statement in the way…IF 5 boxes checked do this calculation ELSE do this calculation.

    Hope that helps you understand my problem.

    Like

  3. I have an “order form” that has products and quantities, but customer has asked ” Is there way to have a ‘total’ field indicated (perhaps at the bottom) that tallies up as the customer selects individual quantities, and then doesn’t allow for the ‘Order Now’ to be clicked on until this reaches 25?”

    Can anyone help with this?

    Like

      1. maybe it is stupid question.
        you are geting data from field with id #ce
        jQuery(“#ce”).on(“change”, function() {
        ce= this.value ;

        but how i can get data from CE and PE and then make calculation for AR

        Like

  4. Hi is there a posibillity for dropdown-menu options?
    I have this dropdown list and I want to add an id to each country-option, so Germany is ID=1, Austria is ID=2, and so on. So I can count with the number 1, when it is choosen Germany.
    Country*
    [select* country “Germany” “Austria” “Switzerland” “USA” “Great Britain” “Poland”]

    Like

  5. Hi,
    How does the example jquery script change when the variables ce and ps are unrelated? I want to fill in a number for ce, another number for ps, and then let ar be calculated as ar=((ce*20)+(ps*40));
    Is that possible?

    Like

  6. Hey, I have an auto calculation to create but even with your tutorial i don’t understand, here’s the problem :

    I got a text field named : “House value”
    And an other text field named : “Remaining capital”

    And my condition is : “Remaining capital” doesn’t have to exceed 50% of “House value”

    If it exceed 50%, I would like it load an error message which is “sorry remaining capital doesn’t have to exceed 50% of the house value”

    I hope you can help me, thanks.

    Like

  7. I have another question for you.
    From the script we get and save the calculated ps and ar.

    Can we call the var of those saved numbers and use them in another calculation below the first one ?

    Thank you

    Liked by 1 person

      1. Hi Om
        I am trying to use the result of ar in your code and use it for some more sums, but i either get no result or NaN depending on what I try.
        After your code I am running this code

        jQuery(document).ready(function(){
        var ar;
        var benefit;
        var finalincome;

        jQuery(“#benefit”).on(“change”, function() {
        benefit= this.value ;

        finalincome=(benefit)+(ar);
        jQuery(“#finalincome”).val(finalincome.toFixed());

        });

        });

        Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s