Skip to main content
Nintex Community Menu Bar

Set Value of Text Box from Calculated Control via JavaScript

  • August 22, 2017
  • 3 replies
  • 83 views

Forum|alt.badge.img+1

I have been searching and testing JavaScript for several days now and can't get this to work (because I am no JavaScript expert).  I simply need to set the value of a Single Line Textbox control with the value being calculated in a Calculated Value control. (The Textbox control has to be used in a List View filter, as Calculated Value controls cannot be used.)

I have set the JavaScript variables in both controls:

  • Calc control variable = calLocNum
  • Text control variable = txtLocNum

I also need the Text control value to update whenever the Calc control value changes.  So, this is the JavaScript that I think is close to what I need, but it doesn't work.

NWF.FormFiller.Events.RegisterAfterReady(function()

{

NWF$("#" + calLocNum).change(function()

{

NWF$("#" + txtLocNum).val(NWF$("#" + calLocNum).val());

});

The other thing I find is the use of double quotes versus single quote around the #. Which is correct?  I'm using Nintex Forms 2010 on prem.                  

3 replies

Forum|alt.badge.img+14
  • Scholar
  • August 23, 2017

wouldn't it be an option for you to connect calculated value control to a single line text list field?

that would be much easier and straightforward.


Forum|alt.badge.img+5
  • August 31, 2017

If you are trying to have the value of the single line text box change dynamically based on changes in the calculated field, you can have the calculated field include a javascript function.  Pass what you want the calculated field to be through the UpdatetxtLocNum function and have it update your single line text box. 

207187_pastedImage_4.png

207188_pastedImage_5.png


Forum|alt.badge.img+3
  • September 11, 2017

Both forms of quotes work. Single quotes though don't require a shift. I typically only use double quotes when I am writing a static string but never when defining objects. I find it helps make things more readable.