Adding a change event, to a list lookup, in a repeat section

  • 7 February 2018
  • 4 replies
  • 4 views

Badge +1

Hi,

I am trying to add a change event, to a list lookup, in a repeat section, using JavaScript.

Currently I am adding the event handler in the RegisterRepeaterRowAdded function. But the change event only fires when a new row is added. I would like the event to fire any time the user changes the lookup.

NWF.FormFiller.Events.RegisterRepeaterRowAdded(function (){

   var currRow = NWF$(arguments[0][0]);

   currRow.find('.cable-lookup select').change(

      repeatCableChanged(currRow.find('.cable-lookup select'))

   );

});

function repeatCableChanged(cableLookup) { alert(cableLookup.val()); }


4 replies

Userlevel 5
Badge +14

the problem with your code is that you do not attach a handler function that should be invoked when the event happens but rather result of function call.

your code should look like

currRow.find('.cable-lookup select').change(repeatCableChanged);

or

currRow.find('.cable-lookup select').change(function(){
      repeatCableChanged(currRow.find('.cable-lookup select'));
})‍‍‍‍‍‍

repeating section‌ control‌ lookup‌

Badge +1

Thanks so much  ! This works perfectly happy.png

Badge +3

Thanks for the solution Marian Hatala‌ .

Just curious , how do you get the script colour coded . Is there someplace where we can test for syntax error etc ... rather than testing in Nintex form.

Userlevel 5
Badge +14

it's just a feature of post editor happy.png 

221755_pastedImage_1.png

Reply