Force unique choice on two dropdowns

Discussions about Cross-site Lookup
Post Reply
Jaydius
Posts: 42
Joined: Thu Nov 12, 2015

28 Nov 2017

I have two drop downs on a form - 'Actionedby' and 'Checkedby'. They are both look ups from a personnel list.

I need the form to require a unique value on each drop-down, e.g. the person who carried out the job cant be the one that checks its been done.

User avatar
Nikita Kurguzov
Posts: 883
Joined: Mon Jul 03, 2017

28 Nov 2017

Hello, Jaydius!
Sounds really simple - all you have to do is add some JavaScript to the Form that will fire when either one of the fields changes and if the values are the same for both, will give an error and remove the latest change from the field.

All information you need can be found in this article, so check it out - https://spform.com/javascript-framework ... eld-values

Scripts might differ slightly if you use Cross-site Lookup instead of classic SharePoint Lookup, but not by much and all the required code can be found in the article above. If you struggle with the code, you can also let me know about it, as well as if you use Cross-site Lookup, classic SharePoint Lookup or even People Picker field, and I'll try to help you write the script as it should be fairly straightforward.

Finally, if you use Cross-site Lookup and don't want to even see repeating option in the dropdown menu, you can also configure filtering for your fields, so that results cannot be the same as the other field. This is more of a cosmetic change as it shouldn't affect functionality by much, but can be a nice touch to your form. Read about CSL filtering here - https://spform.com/cross-site-lookup/fi ... ite-lookup
Cheers

Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 2 guests