AnsweredAssumed Answered

Force a Calculated Value Control Update with JavaScript

Question asked by cholslin Champion on Jan 11, 2019
Latest reply on Jan 15, 2019 by cholslin

Synopsis:

 

A Nintex Form (SharePoint 2013) has a calculated value control which shows the login name of the current user when they create a new item in a SharePoint list. A block of JavaScript from the Custom JavaScript associated with the form needs to grab this value from the calculated value control on document ready. The ID of the calculated value control is saved in a JavaScript variable called varCalc.

 

Issue:

 

The val() of the calculated control is empty when the JavaScript runs on document ready. NWF$('#' + varCalc).val() returns nothing. However, when executed in the browser debugger Console after the page has fully loaded the calculated control is NOT empty.

 

Attempted Solution:

 

Calling NWF.FormFiller.Functions.ProcessOnChange(NWF$('#' + varCalc)) does not force the calculated value rule to fire and update the control. Is there a way to get this value?

 

Actual Code from Custom JavaScript Box in Form Designer:

 

NWF$(document).ready(function() {
   // Force a process for the calculated value control
   NWF.FormFiller.Functions.ProcessOnChange(NWF$('#' + varCalc));
   NWF$('#' + varSingleLineOfText).val(NWF$('#' + varCalc).val());
});

 

Is there a way to overcome this issue?  It feels like a race condition between the calculated value handler and the Custom JavaScript.

Outcomes