Adding text to calculations

  • Profile Image
    Asked on March 15, 2016 at 06:19 AM



    I need to add some text the calculation field on a form so that is shows the user what they have scored for each section out of a possible max. However when I add the "out of" text it seems to corrupt the final calculation. I have an example of what I mean here

    On loading the form the Total already has 300 out of 300 but no fields have been selected. Selecting fields just corrupts the totl further.


    Many thanks

  • Profile Image
    Answered on March 15, 2016 at 09:29 AM

    If you add text into one calculation field, that calculation field cannot be used in other form calculation fields anymore - or it will cause the conflicts of the type you have experienced. There are two workarounds to achieve what you are after, you can choose any one of them you may prefer.

    1. The easiest method is that you do not add text into section calculations. If you want to indicate out of how many possible points the section total was calculated, you may want to:

    a) either put it into the label of the section calculation field:

    or b) hide the calculation field and use a regular Text field that will display the calculated amount instead:

    In the above image, {section15} is the name tag of the section 1 calculation field. You can see the correct name tag to use within your custom message by following this guide:

    By using a Text field to display the message, you even have some nice styling options available, such as making the text bold, or coloring the actual total that the user scored in this section:

    The above would be the recommended way to set up the section scores.

    2. If you still want to add text directly into your section calculations, then you should set up your total calculation not to calculate from the section calculations, but from the fields within the sections themselves.

    In other words, if calculation for section 1 calculates as A1 + B1, and section 2 calculation calculates as A2 + B2, you would use total calculation such as this one:

    (A1 + B1) + (A2 + B2)

    Currently, your total calculation is set to calculate the section calculations that have text, which is causing the conflict because in practice it results in this:

    (A1 + B1 out of 300) + (A2 + B2 out of 300)

    So in case you want to have text directly within the section calculations, for the total calculation, you would be using only the fields marked in green in the following screenshot:

    If you need any further assistance, please let us know.

  • Profile Image
    Answered on March 15, 2016 at 09:39 AM

    I see the issue now and will go with one of your solutions. Many thanks for the speedy response Boris. 

  • Profile Image
    Answered on March 15, 2016 at 10:42 AM

    Great! Glad to see that you have identified the issue on the form. Please do not hesitate to get in touch with us if you need any further assistance. We will be happy to help. 

    Thank you for using JotForm!!