• Resolved Bakhshi

    (@bakhshi)


    Hello
    Is it possible to have two calculation buttons in one form?
    that’s mean,Each button calculates some fields.

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

    (@codepeople)

    Hello @bakhshi

    No exactly, a calculate button force the evaluation of all equations in the form, however, there is always a trick.

    For example, assuming there are two buttons in the form, button A and button B, configure their types as button and not as calculate.

    Enter as the onclick event of first button the piece of code:

    
    flag='A';fbuilderjQuery.fbuilder.calculator.defaultCalc('#cp_calculatedfieldsf_pform_1');
    

    and as the onclick event of the second button:

    
    flag='B';fbuilderjQuery.fbuilder.calculator.defaultCalc('#cp_calculatedfieldsf_pform_1');
    

    as you can see, each button generates the “flag” variable with a different value depending on button, and then call method that evaluate the equations.

    In the different equations you should check the existence of flag variable and its value.

    For example, if the equation associated to a calculated field is:
    fieldname1+fieldname2
    it should be edited as follows:
    IF(flag=='A', fieldname1+fieldname2, __ME__)

    and if the equation associated to the second calculated field is:
    fieldname1*fieldname2
    it should be edited as follows:
    IF(flag=='B', fieldname1*fieldname2, __ME__)

    Best regards.

    Thread Starter Bakhshi

    (@bakhshi)

    thank you very much.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Two calculation buttons in one form’ is closed to new replies.