• Resolved FramSteget

    (@framsteget)


    Hi,
    When checking more than one checkbox calculations are not correct.

    URL: https://xn--tryckbcker-jcb.se/produkt/pdf-for-tryckning/

    Under “PRISBERÄKNING” enter 10000 in field “Skriv in antal ord*”.
    Checkbox #1 has value 2200
    Checkbox #2 has value 3200

    When the two checkboxes are checked the calculation reads 22,004,300 kr. It should be 6,500 kr.
    The calculation should be 2,200+4,300=6,500, but it shows 22,004,300.

    • This topic was modified 7 years ago by FramSteget.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @framsteget,

    For some reason, the values are being treated as texts instead numbers and are being cocatenated.

    Please, follow the steps below to force the browser to treat them as numbers (I will include the modifications in the official distribution of the plugin):

    1. Open the “/wp-content/plugins/calculated-fields-form/js/fields-public/06_fbuilder.fcheck.js” file with the text editor of your choice.

    2. Go to the piece of code:

    if(!$.isNumeric(t)) t = t.replace(/^"/,'').replace(/"$/,'');

    and modify it as follows:

    if(!$.isNumeric(t)) t = t.replace(/^"/,'').replace(/"$/,'');
    else t = t*1;

    3. Finally, delete the file: “/wp-content/plugins/calculated-fields-form/js/cache/all.js” to allow the changes take effect, and that’s all.

    Best regards.

    Thread Starter FramSteget

    (@framsteget)

    Hi,
    Now it’s working.
    Calculations are done fast on Chrome. But all other browsers are very slow when there are much code to process.

    Thanks

    Plugin Author codepeople

    (@codepeople)

    Hello,

    I’m testing your form in different browsers and the performance is similar in all of thems. Remember that if you have deleted the cached file (all.js) the plugin will generate it again the first time the form is loaded, and the process is more time consuming, but one time the cached file is created the form’s performance is increased dramatically.

    Best regards.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Checkboxes and calculation’ is closed to new replies.