• Resolved mordaskyt

    (@mordaskyt)


    I am creating a form to calculate the square footage of walls and ceilings. You enter the height and width of a wall, number of doors and windows, and the form calculates the square footage of that wall. Fantastic. Now I need to add that calculation to a running total, so you can keep adding walls to create the entire room. So an “add this wall to your total” button or similar. Any insight or direction is much appreciated. Thank you

    https://www.ads-software.com/plugins/calculated-fields-form/

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

    (@codepeople)

    Hi,

    The current version of the plugin does not generates fields dynamically at runtime, but you can implement your idea as follow:

    – Enter multiple DIV fields in the form, each DIV represent a different wall, and enter in all of them class names: wall hide, through the attribute: “Add Css Layout Keywords”. Separate the class names by a space.

    – Into each DIV field, insert 4 input fields: height, width, number of doors, number of windows.

    After insert all DIV fields, insert a button field to display a different DIV when pressed, until reach the number of DIV fields inserted previously. The onclick event of button would be: jQuery(‘div.wall:hidden’).first().show();

    And finally, a calculated field with the total equation.

    Best regards.

    Thread Starter mordaskyt

    (@mordaskyt)

    Thank you, I believe what I need is simpler than this, as I do not need multiple instances of the original calculation, I simply need to create a button that when pressed adds the total of field A (the results of the original wall equation) to a field B which would represent the total for the room.

    See the sample here:

    https://tigerfoam.com/sprayfoaminsulation/form-temp/

    Plugin Author codepeople

    (@codepeople)

    Hi,

    In this case the equation would be as simple as adding both fields, for example: fieldname1+fieldname2 (the names of fields have been selected randomly). If you want that the equations are evaluated, only after pressing a calculate button, you should untick the option: “Eval dynamically the equations associated to the calculated fields” in the “Form Settings” tab.

    Best regards.

    Thread Starter mordaskyt

    (@mordaskyt)

    That is how I tried to set it up. The final results field does not seem to allow me to select itself as a value, i.e. the “fieldname2” in your example. after I hit save it strips out itself from the equation, leaving only fieldname1 behind.

    Plugin Author codepeople

    (@codepeople)

    Hi,

    I’ve checked the equations in your form:

    The equation associated to the “Project Total” field is:

    +fieldname1+fieldname1

    the correct would be fieldname1+fieldname1, or better 2*fieldname1, to prevent replace the fieldname1 field twice.

    Best regards.

    Thread Starter mordaskyt

    (@mordaskyt)

    Fantastic, thanks for the help!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Adding results to create a running total’ is closed to new replies.