Conditions: Calculate field turns true when submission is edited

  • dshannon
    Asked on November 29, 2023 at 8:50 AM

    I have a two Form Calculation Widgets that work properly for a new entry but if the form is rejected/denied and sent back for updates, the calculations don't update based on the new inputs. My form is below. The fields that don't calculate correctly are the Meal Break Penalties and Total Penalties. Please advise. Thank you!

    https://form.jotform.com/233304308521142

  • Mikhail JotForm Support
    Replied on November 29, 2023 at 10:49 AM

    Hi Karisa, 

    Thanks for reaching out to Jotform Support. I checked your form, and it seems that you have a complex calculation. Can you explain more about the form calculation and which field don't calculate properly when the submission is edited? If you can take a screenshot of what’s happening, that will help us to better understand what’s going on. We have a guide about how to do that here.

    Once we hear back from you, we'll be able to move forward with a solution.

  • dshannon
    Replied on November 30, 2023 at 9:15 AM

    Hi. So when the form is rejected and sent back for edits, the yellow highlighted fields don't calculate correctly. However, I don't think those fields are the issue. Those yellow fields are pulling from the fields circled in red and those fields are the ones that aren't working correctly in a rejected form.Conditions: Calculate field turns true when submission is edited Image 1 Screenshot 20

  • Gilbert JotForm Support
    Replied on November 30, 2023 at 10:38 AM

    Hi Karisa,

    I did several tests on a cloned version of your form and there seems to be an issue with the condition to insert the value 1 to Meal #2 Penalty Calc.

    Conditions: Calculate field turns true when submission is edited Image 1 Screenshot 80

    The condition states that if any of the rules are met, the value 1 will be inserted into the Meal #2 Penalty Calc field. The issue here is that when you initially open the form even without filling out any fields, the "Length of Meal #2" field already has a value of 0 which triggers the condition since it's less than .50 so it already inserts the value 1 into the Meal #2 field.

    Conditions: Calculate field turns true when submission is edited Image 2 Screenshot 91Since there are no other conditions to set a different value on that Meal #2 field, it will retain the value 1 even if the 'Length of Meal #2' calculates a value greater than .50 or the 'Hrs Before Meal #2' has a value less than 9.99.

    That's why even if the values of these 2 fields don't match the rules in the condition, the value 1 is still inserted into the Meal #2 field because as soon as the form is opened, the condition is already triggered since the default value of the 'Length of Meal #2' field is 0 which is less than .50.

    Conditions: Calculate field turns true when submission is edited Image 3 Screenshot 102

    To fix this, you'd have to modify the condition to insert the value of 1 into the Meal #2 Penalty Calc field. Remove this other IF rule:

    IF: 36. Hrs Before Meal #2

    STATE: Greater Than

    TARGET: Value

    VALUE: 9.99

    and replace it with

    IF: 32. Length of Meal #2

    STATE: Is Not Equal To

    TARGET: Value

    VALUE: 0

    and set the condition to trigger if ALL the rules are matched. Here's what the condition would look like:

    Conditions: Calculate field turns true when submission is edited Image 4 Screenshot 113

    Then, add a separate condition for the 36. Hrs Before Meal #2 field that uses the same IF rule as the one you removed from the other condition

    Conditions: Calculate field turns true when submission is edited Image 5 Screenshot 124

    So there will be two conditions to insert the value 1 to the Meal #2 Penalty Calc field

    Conditions: Calculate field turns true when submission is edited Image 6 Screenshot 135

    This will ensure that the value 1 won't be inserted into the Meal #2 Penalty Calc field even if the Length of Meal #2 field value is 0. You can do the same for the condition tied to the Meal #1 field since it also automatically inserts 1 to the Meal #1 Penalty Calc field.

    Conditions: Calculate field turns true when submission is edited Image 7 Screenshot 146

    Give it a try and let us know if you have any other questions.

  • dshannon
    Replied on December 1, 2023 at 9:56 AM

    Hi. I implemented the changes but it didn't fix the issue. From what I can tell, none of the penalty calc fields recalculate in the rejected form. So no matter what's entered in the time entry fields in the rejected form, none of the penalty fields are updated resulting in correct calcualtions. These are the fields that don't recalculate in the rejected form when new time inputs are entered.

    I cloned my form for the suggested changes so please use this link. https://form.jotform.com/233343550049149

    Conditions: Calculate field turns true when submission is edited Image 1 Screenshot 20

  • Mikhail JotForm Support
    Replied on December 1, 2023 at 12:16 PM

    Hi Karisa,

    Thanks for getting back to us. I’ll need a bit of time to look into this. I’ll get back to you as soon as I can.

    We really appreciate your patience and understanding. 

  • Mikhail JotForm Support
    Replied on December 1, 2023 at 2:39 PM

    Hi Karisa,

    Thanks for getting back to us. When I cloned and tested your form, the same thing happened for me. After investigating, I found a solution. I changed the Calculation Field from "Length of Meal 1 is Not equal to 0" to "Greater than 0". Since your calculation on the Length of Meal 1 will not go negative, I tried this method, and it works on my end. Is this something that will work on your calculation? 

     Conditions: Calculate field turns true when submission is edited Image 1 Screenshot 30

    When the edit link clicked, the Penalty Calc didn't insert "1" on the field since it didn't meet the conditions that we set.

    Conditions: Calculate field turns true when submission is edited Image 2 Screenshot 41

    If this works for you, you can change the other conditions too to "Greater Than 0".

    Give it a try and let us know how it goes.


  • dshannon
    Replied on December 4, 2023 at 11:05 AM

    We're getting there. However, there is still an issue with the penalty fields updating when the form is edited. I submitted a test that should have produced 1 Meal Break Penalty (and it did - Screenshot #1) but for testing purposes, I rejected the form and edited it so that no penalties should have calculated (Screenshot #2) for Meal Break Penalties but the form isn't updating the calculations in yellow when changes to the time entries are made. You can see in the second screen shot the the length of meal #1 is updated to .5 from the original .25, the form still calculates a meal break penalty but it shouldn't. The length of .5 for both meal breaks shouldn't produce a penalty. This doesn't happen in the original form, just and edited form. so I feel like the calculations are working they just aren't updating in the edited form.

    Conditions: Calculate field turns true when submission is edited Image 1 Screenshot 30

    Conditions: Calculate field turns true when submission is edited Image 2 Screenshot 41

  • Karisa Adams
    Replied on December 4, 2023 at 12:13 PM

    I should add that I've cleared the cache from my browser and the form within Jotform. Neither resolved the fields failing to update when new data is entered in a rejected form.

  • Mikhail JotForm Support
    Replied on December 4, 2023 at 12:15 PM

    Hi Karisa,

    Thanks for getting back to us. I cloned your form to test it, and I easily replicated the issue. There is an easy fix for this, we just need to add another condition that will make it 0 when the Length of Meal is 0.5 and above. Let me show you how: 

    • Open your form in Form Builder, and in the orange navigation bar at the top of the screen, click on Settings.
    • Click Conditions on the left pane, and click Add Condition and choose Update/Calculate Field. Then copy the condition below: Conditions: Calculate field turns true when submission is edited Image 1 Screenshot 30
    • Click Save, and that's it.

    This is how it will look like after adding the condition:

    Conditions: Calculate field turns true when submission is edited Image 2 Screenshot 41

    If this solution works for you, you can use the condition to the other fields that needs it.

    Give it a try and let us know how it goes.

  • dshannon
    Replied on December 4, 2023 at 4:22 PM

    We are so, so close. The highlighted field still isn't populating correctly with changes. I don't think it has been all along but was overlooked as we focused on changes for the other penalty fields. Like the others, the highlighted field works properly in the original form but when edits are made and a penaltyConditions: Calculate field turns true when submission is edited Image 1 Screenshot 20 is triggered, the field doesn't adjust correctly when the time entries are adjusted to avoid a penalty. Suggestions?

  • Sonnyfer JotForm Support
    Replied on December 4, 2023 at 9:08 PM

    Hi Karisa,

    I'm very sorry to hear that. I'll need a bit of time to look into this. I will be back shortly.

  • Sonnyfer JotForm Support
    Replied on December 5, 2023 at 12:57 AM

    Hi Karisa,

    Thanks for patiently waiting. I checked the only condition connected to the Meal#2 Total Penalties field and see that it's set to have the value "1" if the below conditions are met.

    Conditions: Calculate field turns true when submission is edited Image 1 Screenshot 20

    It's working as expected according to your screenshot. Can you tell more about what you're trying to do with this field?

    After we hear back from you, we'll be able to help you with this.


  • Karisa Adams
    Replied on December 5, 2023 at 9:49 AM

    Please review the ticket history or, if possible, have Mikhail (the original support person) assist. The thread explains the form works properly when it's originally populated and submitted. However, if it's rejected for changes, it will no longer calculate the field properly with the updates.

  • Mikhail JotForm Support
    Replied on December 5, 2023 at 10:36 AM

    Hi Karisa,

    Thanks for getting back to us. I’ll need a bit of time to look into this. I’ll get back to you as soon as I can.

    We really appreciate your patience and understanding. 

  • Mikhail JotForm Support
    Replied on December 5, 2023 at 10:52 AM

    Hi Karisa,

    Thanks for patiently waiting. To resolve this issue, you may add a condition that will check if the previous fields are not 1. Let me show you how to do that:

    • Open your form in Form Builder, and in the orange navigation bar at the top of the screen, click on Settings.
    • Click Conditions on the left pane, and click Add Condition and choose Update/Calculate Field. Then copy the condition below: Conditions: Calculate field turns true when submission is edited Image 1 Screenshot 30

    This is how it will behave after adding this condition:

    Conditions: Calculate field turns true when submission is edited Image 2 Screenshot 41

    Give it a try and let us know how it goes.

  • dshannon
    Replied on December 5, 2023 at 4:25 PM

    Hi. I added the new condition to the form and immediately had another calculation error when I started testing various scenarios. It doesn't appear that we'll ever be able to add all the necessary rules/conditions to make the rejected form work properly. At a high level, can you tell me what that is? It doesn't make sense that everything works as expected in the original form but not in a rejected form. Why would they require different rules?

  • Jovanne JotForm Support
    Replied on December 6, 2023 at 6:48 AM

    Hi Karisa,

    Can you explain a bit more about the other calculation errors you're talking about when testing it on various scenarios so we can have a better idea? Can you send a screen recording so we can better understand the issue?

    Once we hear back from you, we can help you with this.

  • Karisa Adams
    Replied on December 6, 2023 at 8:32 AM

    All the fixes we've done on this thread were because the rejected form doesn't calculate correctly like the original form. I could likely provide many different scenarios where the rejected form doesn't work the same but we already have several examples in our thread. It just doesn't make sense why the rejected form doesn't work the same as the original form.

  • Mikhail JotForm Support
    Replied on December 6, 2023 at 10:34 AM

    Hi Karisa,

    Thanks for getting back to us. As I understand, initially, we are creating a condition to fill a field with a value to be able to calculate. And then, when we are editing the submitted form with a field that has a value, we don't have a condition that will remove that value. Notice the recent conditions that we created, we are inserting a value of 0. So to make the form working properly even when being edited, you have to create a condition that will clear the value of the field in different scenarios.

    Let us know if there’s anything else we can do for you.

  • dshannon
    Replied on December 7, 2023 at 6:12 PM

    It sounds like many new conditions would be required for our rejected form to calculate properly. Is it possible to simply write one condition or rule that says to set all the calculations to zero on rejected form until adjusting entries are made then have all the fields recalc?

  • Billy JotForm Support
    Replied on December 7, 2023 at 10:26 PM

    Hello Karisa,

    Thanks for getting back to us. We've got a quite lengthy ticket here so I'm gonna need some time going over it to provide you with an accurate answer. I'll reach out again as soon as I have an update.

    We appreciate your patience and understanding.

  • Billy JotForm Support
    Replied on December 7, 2023 at 11:45 PM

    Hi Karisa,

    Thanks for patiently waiting. Resetting the calculations back to 0 when denying the request is not possible. You can only update the values when editing the form.

    I carefully reviewed your form conditions and found that there's one unnecessary condition that we can disable as you can see in the screenshot below:

    Conditions: Calculate field turns true when submission is edited Image 1 Screenshot 20

    After disabling that, I tested the form a few times and the fields that don't update are already updating. You can test this sample form.

    Let us know how it goes.