Skip to main content

Hi,

Can we compare dropdown values in Repeating section?

I would like to compare the dropdown values in Repeating section to avoid duplication records. Can we use compare validator for Repeating section?

Could someone maybe help me out?

Thanks,

Swap

Hi,

Just found below solution on internet.

1. insert below javascript to Form Setting Custom Javascript section

function allValuesUnique(Item)

{

var allValuesUnique = true;

debugger;

NWF$.each(Item, function (key1, value1) {

NWF$.each(Item, function (key2, value2) {

if (key2 != key1 && value2 == value1)

{

allValuesUnique = false;

}

});

});

return allValuesUnique;

}

2. Create a new rule based on Repeater section

3. Select Rule Type - Validation

4. Set Condition - !allValuesUnique(<Dropdown Control Name>)

Thanks,

Swapnil


Hi, The script is not working for me, is this working for you?


Yes, all runs fine. Have you created rule and specified name of the dropdown in it?

189365_pastedImage_1.png

189328_pastedImage_0.png

Swap


Have you tried below solution again?


That didn't work for me probably because my dropdown is a lookup value from another list


I think this solution should work for lookup field dropdown value as well.

190246_pastedImage_0.png

190256_pastedImage_1.png


I will again try and will let you know If I am getting any error


Hi, could be done also without JS with classic rules? If you use responsive design forms you can't use JS anymore. Thanks.


Reply