Compare People Picker Field Names
Hi,
I have a form with two people picker fields in which the two fields cannot have the same person chosen. How do I compare the values in the two fields, and if they are the same alert the user on submit.
See my code below, but I keep getting an error:
fd.onsubmit(function () {
if (fd.field('Owner').value() == fd.field('Checker').value()){
alert('Owner cannot be the same as Checker'');
return false;
}
return true;
});
I have a form with two people picker fields in which the two fields cannot have the same person chosen. How do I compare the values in the two fields, and if they are the same alert the user on submit.
See my code below, but I keep getting an error:
fd.onsubmit(function () {
if (fd.field('Owner').value() == fd.field('Checker').value()){
alert('Owner cannot be the same as Checker'');
return false;
}
return true;
});
Hello enillrae,
If the field Template is set to Default, you can use the below code to get the value of two people picker fields and compare them.
If the field Template is set to Default, you can use the below code to get the value of two people picker fields and compare them.
Code: Select all
fd.onsubmit(function () {
if (fd.field('Owner').value()[0].Key == fd.field('Checker').value()[0].Key){
alert('Owner cannot be the same as Checker'');
return false;
}
return true;
});
-
- Information
-
Who is online
Users browsing this forum: No registered users and 4 guests