Populate dynamically a calculated value by using a JavaScript function call

  • 23 October 2017
  • 2 replies
  • 370 views

This post intends to demonstrate how a JavaScript/JQuery function can populate a calculated value control dynamically within a Nintex Form. Accessing data by using REST API Service makes dynamic content compulsory.

 

Here is the form view that shows unpopulated calculated value controls as following.

 

 

In order to resolve this issue, I have decided to force calculated values to be recalculated by JavaScript code.To accomplish this, we need to setup following steps.

  1. Define a textbox with the name of 'hiddenField' and set « Store Client ID in Javascript variable » to Yes and give the value of « Client ID Javascript variable name » as 'hiddenFieldPageID'.
  2. Then all our calculated values formula should be included with a reference to the textbox.
  3. In our calculated values, add a reference as a parameter that does not be used in our Javascript method.
  4. Ensure the formula is set to getLabel("lblSecondLang1",hiddenField).
  5. You will be able to force a calculated value to recalculate by calling these following lines of JavaScript code.

            var hiddenTextBox = NWF$("#" + hiddenFieldPageID);
            NWF.FormFiller.Functions.ProcessOnChange(hiddenTextBox);

 

The calculated value settings as shown below.

 

 

If you noticed, I have added the 'hiddenField' control into the fuction as a parameter, which causes the calculated value is triggered when the control has been updated. Finally, calling of JavaScript function ProcessOnChange refreshes the controls' value again.

 

 

calculated value control‌ dynamic population‌ resize at runtime


2 replies

Userlevel 5
Badge +9

Thanks a lot Mustafa !

This blog will help to create multilingual forms !

Userlevel 5
Badge +12

 NWF.FormFiller.Functions.ProcessOnChange();   ------> just what I was looking for   Thank you!

Reply