Nintex Form - Re calculate when value changes on hidden field

  • 9 March 2018
  • 2 replies
  • 24 views

Badge +7

Hello there -

I have a requirement where I have a single block where Quantity and Amount fields present. And then I will have a checkbox to choose more 5 blocks then it will show 5 more Quantity and Amount fields. I need to show user the total amount of above all 6 blocks (Qty1*Amt1)+(Qty2*Amt2).. and so on

I have a calculated control with above formula which is working fine.

But I have Javascript which does the job of clearing the data on Qty2, Amt2 .... Qty6, Amt6 fields data when checkbox is unchecked. when this happens Calculated control is not updating the Total value. (Q2,A2...Q6,A6 are hidden and calculated control can't take these values as null in hidden mode might be the reason as per my understanding).

But can anyone help me in fulfilling this requirement in any other way would be a great help to me!

PS: I have a workflow to calculate all values from above fields and update a back-end SharePoint list column with Calculated value which is of Currency type. But Nintex form is not allowing to show this calculated type list column on form.

I thought of using Nintex Calculated control so I can update Total in real-time but I stuck at above section.

Thanks,

Soni


2 replies

Userlevel 3
Badge +12

Hi Soni,

"Calcucated Field" control takes care of recalculating the value based on the changes of input fields.

When you are hiding the control using check/uncheck event, clear the content of the hidden fields are set to 0, formula will be recalculated and calculated field value gets updated.

Userlevel 5
Badge +14

It's difficult to tell explicitly what is happening just from text with no screenshots, code, or software version. However, usually when a control isn't updating that is dependent on other control values, it means that the updated controls it's relying on are not being updated correctly. 

Assuming that they just Single Line Text controls (ie: <input> elements), I would recommend first triggering the focus event, then updating the value, and then triggering the blur event. 

Roughly your code will look like: 

var inputControl = NWF$("#" + singleLineTextControlID);    
inputControl.trigger("focus").val(0).trigger("blur");‍‍‍‍

Even on an older version of Nintex Forms, this should invoke the rest of the updating process which would trigger any Calculated Controls or Form Rules that depended on the now updated value. 

I hope that this helps. 


Reply