AnsweredAssumed Answered

How to set list lookup field in a repeating section, copied from anothe'r item's repeating section?

Question asked by jpmhuls on Sep 6, 2018

For a project I have included on a Nintex Form an option to select from other items in the list and have both metadata as well as other form data copied into the current new item. All is working well, except for a list lookup in a repeating section. It does select the proper value (seemingly based on the lookup item's list item ID (currFieldValue in snippet below), but when saving the validation rule kicks and says it needs a value selected.

$currRow.find("." + currFieldLabel + " select.nf-client-control").val(currFieldValue);

Considering the fact that outside a repeating section one also has to set the Selected attribute, I would guess this is also required within the repeating section. Whatever I try, it does not seem I've found the proper command setup.

NB: I'm copying from another item using a (JS) query which only returns a list lookup ID value (and thus not also the display value). Using the following snippet did not work for me to set the selected value of my list lookup in the repeating section:

var tmpDispVal = NWF.RuntimeFunctions.SPLookup("Currencies","ID",currFieldValue,"Currency").done(function(data) {

    $currRow.find("." + currFieldLabel + " option:contains(" + data +")").attr("selected", true);

});

 

Also, SPLookup seems to be async..... So any info on a sync version of calling the inline function lookup() from JavaScript would also be welcome.

 

UPDATE: The following two code snippets did not result in the list lookup doprdown selections in the repeating section to be accepted::

var currField = $currRow.find("." + currFieldLabel + " select.nf-client-control")[0]; // Test only - Can be removed

$currRow.find("." + currFieldLabel + " select.nf-client-control")[0][parseInt(currFieldValue)].selected = true;

$currRow.find("." + currFieldLabel + " select.nf-client-control").val(currFieldValue).focusout();

 

var currField = $currRow.find("." + currFieldLabel + " select.nf-client-control"); // Test only - Can be removed

currField.val(currFieldValue);

currField[0][parseInt(currFieldValue)].selected = true;

currField.focusout();

Outcomes