Can we compare dropdown values in Repeating section?


Badge +4

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


8 replies

Badge +4

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

Badge +9

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

Badge +4

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

Badge +4

Have you tried below solution again?

Badge +9

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

Badge +4

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

190246_pastedImage_0.png

190256_pastedImage_1.png

Badge +9

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

Badge +1

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

Reply