Skip to main content
Nintex Community Menu Bar

Set calculated value in Textbox

  • April 27, 2020
  • 2 replies
  • 20 views

Forum|alt.badge.img+2

Hello,

I have a textbox in which I defined the value of a calculated field using JavaScript. Here is the JS Code:

NWF$(document).ready(function(){
   NWF$('#' + CenCouVal).change(function(){
      var selection = NWF$('#' + CenCouVal);
      NWF$('#' + varText).val(selection.val());
   });
});

CenCouVal represents the client ID JavaScript variable name of the calculated value.

varText represents the client ID JavaScript variable name of the textbox.

 

This textbox is located in a Repeating Section in which I have defined 3 rows by default (see picture below). Can someone tell me how I can put the textbox value in the red box in the first row ? Is it also possible to set this value in all textboxes on this column ? Thanks

 

7615iBC6DB49D64549017.png

2 replies

Forum|alt.badge.img+8
  • Novice
  • April 28, 2020

Hi,

 

according to my testing, the client ID JS Variable only targets the first row in a repeating section.

Your existing script looks fine to me. Have you tried to set the text to something static for testing purposes?

Does this work, when you execute it directly in the console of your browser?

NWF$('#' + varText).val("Test")

If you want to target all the inputs, I suggest adding a css class to them. The class gets copied when a new row is created, therefore you can target all of them like so:

NWF$(".myClass :input").val("Test")

 


Forum|alt.badge.img+2
  • Author
  • April 28, 2020

Thanks for your answer. I applied the second solution and worked very well !