• Resolved Tetra84

    (@tetra84)


    Hi,

    I’m trying to do some simple calculations, but I can’t seem to get the calculate button to work:
    2017-11-30_1114
    right now, when I preview test this, it gives me my answer as I enter them in the boxes and seems to disregard the button entirely:
    https://www.screencast.com/t/5HopInnf4pt

    I’m still trying to figure this out, but ultimately I’d like each of the buttons to preform different calculations ‘on click’ based on what numbers are in the fields and spit the answer out in the same ‘Answer’ calculated field at the bottom.

    2017-11-30_1112

    seems simple, but I’m stuck on some aspect of it.. any help?

    Thanks,
    Paul

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @tetra84,

    If you want evaluate the equations only after pressing the “Calculate” button, you should untick the checkbox: “Eval dynamically the equations associated to the calculated fields” in the “Form Settings” tab (https://cff.dwbooster.com/images/documentation/form-settings-tab.png)

    Best regards.

    Thread Starter Tetra84

    (@tetra84)

    ok so that answers the question with the ‘on click’ but is it possible to tie and run the formulas only to the buttons, or do you also need to have formulas in the answer field? or are you required to have multiple answer (calculated) fields for different formula buttons?

    2017-11-30_1129

    Plugin Author codepeople

    (@codepeople)

    Hello @tetra84,

    The “Calculate” buttons evaluate the equations associated to ALL calculated fields in the form. The buttons are not associated to specific fields. Furthermore, the equation associated to your calculated field is invalid. A possible solution would be:

    – Insert an additional field to determine the equation to evaluate, for example, if you insert a radio buttons field (I will call it fieldname123, you should use the name of the field in your form), with two choices:

    First choice’s text: Evaluate first block
    First choice’s value: 1

    Second choice’s text: Evaluate the second block
    Second choice’s value: 2

    and then, edit the equation associated to the calculated field as follows:

    (function(){
    if(fieldname123 == 1) return fieldname2+fieldname3;
    return fieldname4+fieldname5;
    })()

    There are some other alternatives.

    Best regards.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Calculate Field button not working as I’d think it should?’ is closed to new replies.