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

List Lookup JavaScript in a Repeating Section

The JavaScript that I adapted from another post works well, but only on the first item of a repeating section. Basically it works along 2 lists lookups, setting the default value of the second one after the first one has been selected.

Can someone please show me how to get this code working on all subsequent items added in a repeating section?

I suspect that all that may be needed is to include the 

NWF.FormFiller.Events.RegisterRepeaterRowAdding or NWF.FormFiller.Events.RegisterRepeaterRowAdded function somewhere but where should it go as I'd no luck with it either.

NWF$(document).ready(function () {

NWF$("#" + ResponsibleBU).change(function () {
NWF$("#" + ResponsibleBUEmailAddress).change();
});

NWF$("#" + ResponsibleBUEmailAddress).change(function () {

var ResponsibleBUEmailAddressId = ResponsibleBUEmailAddress.substring(0, ResponsibleBUEmailAddress.length - 4);
var len = NWF$("#" + ResponsibleBUEmailAddressId).find("option").length;
if (len >= 2) {
return delay(500).then(function () {
NWF$("#" + ResponsibleBUEmailAddressId).prop('selectedIndex', 1).change();
NWF$("input#" + ResponsibleBUEmailAddressId).val(NWF$("#" + ResponsibleBUEmailAddressId).find("option")[1]);
});
}
else {

while (i < 10 && len == 1) {
i++;
return delay(500).then(function () {
len = NWF$("#" + ResponsibleBUEmailAddressId).find("option").length;
if (len >= 2) {
NWF$("#" + ResponsibleBUEmailAddressId).prop('selectedIndex', 1).change();
NWF$("input#" + ResponsibleBUEmailAddressId).val(NWF$("#" + ResponsibleBUEmailAddressId).find("option")[1]);
}
});
}
}});

function delay(t) {
return new Promise(function (resolve) {
setTimeout(resolve, t)
});
}});

Labels: (1)
0 Kudos
Reply
1 Reply
mlauer
Nintex Newbie

Re: List Lookup JavaScript in a Repeating Section

see  

0 Kudos
Reply