cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
ebglenn
Nintex Newbie

Set Value of Text Box from Calculated Control via JavaScript

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.                  

Reply
3 Replies
emha
Nintex Newbie

Re: Set Value of Text Box from Calculated Control via JavaScript

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.

Reply
powersj1
Nintex Newbie

Re: Set Value of Text Box from Calculated Control via JavaScript

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. 

0 Kudos
Reply
nps9
Nintex Newbie

Re: Set Value of Text Box from Calculated Control via JavaScript

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.

0 Kudos
Reply