Hello,
Been building a repeater for taking in multiple issue items for my company. Ran into a problem that I need one of the fields to be unique for each section of the repeater. Anybody have any direction on how to do this?
Ben.
Hello,
Been building a repeater for taking in multiple issue items for my company. Ran into a problem that I need one of the fields to be unique for each section of the repeater. Anybody have any direction on how to do this?
Ben.
Is this for Nintex on-Prem 2013/2016 or O365?
O365...
Already started to give up on this
NWF$(".testLU option:selected")[i].innerHTML should give you the selected value of the lookup list
testLU is the css class name of my look up control and i is the ith item in your repeating section.
Thank you Thomas for you reply.
I've tried your advice and it worked. I was able to get the value of the selected lookup field if I put direct index like array[0] instead of array, but if I try to loop something doesn't work. This is my JS script. I hope you can help me, could be a stupid error, just cannot find it.
From memory repeatingSection first value actually starts from index 1 rather than 0 .So if you have three entered value then it would be index 1,2,3
Insert the line “debugger; “ in your code to enforce a breakpoint and use F12 developer tool to examine the values that your JavaScript code evaluates . This will give you a good idea what is happening at runtime.
I've got it working somehow when trying to create a new form
But , If I try to edit the same form later lookup values are not loading in edit mode, working fine in preview mode.
Preview mode
Edit mode
Script i'm using NWF$(document).ready(function(){
NWF$(".LocalsubContractorLookupFieldCss").change(function() {EnsureUniqueValue()});
});
function EnsureUniqueValue(){
if(typeof NWF$(".LocalsubContractorLookupFieldCss option:selected")[1] !== 'undefined'){
var duplicateValueFound=false;
var rpArray= NWF$(".LocalsubContractorLookupFieldCss");
var rpArrayValues=[];
for(var i=1;i<rpArray.length;i++){
rpArrayValues.push(NWF$(".LocalsubContractorLookupFieldCss option:selected").innerHTML);
}
var sortedRpArrayValues=rpArrayValues.sort();
for (var i = 0; i < sortedRpArrayValues.length - 1; i++){
if (sortedRpArrayValues[i + 1] == sortedRpArrayValues){
alert("duplicate values not allowed: "+sortedRpArrayValues);
duplicateValueFound=true;
}
}
if(duplicateValueFound){
NWF$(".nf-repeater-addrow ").hide();
}
else{
NWF$(".nf-repeater-addrow ").show();
}
}
}
The error i'm getting in F12 mode . I'm not even sure what is wrong, i'm checking it not to be 'undefined', if yes just skip. But looks like is something else
Any clues guys?
The error
Some how finally I made it to work. The JS script that works for me.
NWF$(document).ready(function(){
NWF$(".LocalsubContractorLookupFieldCss").change(function() {EnsureUniqueValue()});
});
function EnsureUniqueValue(){
var duplicateValueFound=false;
var rpArray= NWF$(".LocalsubContractorLookupFieldCss");
var rpArrayValues=[];
for(var i=1;i<rpArray.length;i++){
if(typeof NWF$(".LocalsubContractorLookupFieldCss option:selected") !== 'undefined'){
rpArrayValues.push(NWF$(".LocalsubContractorLookupFieldCss option:selected").innerHTML);
}
}
var sortedRpArrayValues=rpArrayValues.sort();
for (var i = 0; i < sortedRpArrayValues.length - 1; i++){
if (sortedRpArrayValues[i + 1] == sortedRpArrayValues){
alert("duplicate values not allowed: "+sortedRpArrayValues);
duplicateValueFound=true;
}
}
if(duplicateValueFound){
NWF$(".nf-repeater-addrow ").hide();
}
else{
NWF$(".nf-repeater-addrow ").show();
}
}
Enter your username or e-mail address. We'll send you an e-mail with instructions to reset your password.