1

I have one Custom list and many column. In that I want to do validation for People picker column in the list. If people picker 1 and people picker 2 values are equal then I should get message box or alert to block user to select same value for both the people picker field.

Please help me out with javascript or other way?

1

In "Validation settings" of a list, you can set formula to check your condition. You can select the columns that you want to use with IF condition to check the equality. Here is a guide to walk you through the process. With this approach, you will be able to show a message at the bottom of the newform dialog.

  • Thank you for your Guidance. I am not getting that Peoplepicker column in Insert column list. Please help me out – Sahul Hameed Oct 14 '14 at 4:48
1

You can use validation settings in list.

 1. Go to List Settings>Validation Settings
 2. In Formula textbox write `IF([FirstPicker column]<>[SecondPicker column],TRUE,FALSE)`
 3. Click OK at the bottom and try it then.

That's true that person or group field will not appear in List validation settings. So I think only possible OOTB way to set validation is using javascript on Newform.aspx.

Write your code in PreSaveAction function in script editor webpart, read two picker field value and match it and accordingly return true or false.

If return true then item will be save din list otherwise not.

Maybe following link can help you: blog

  • Thank you for your Guidance. I am not getting that Peoplepicker column in Insert column list. Please help me out – Sahul Hameed Oct 14 '14 at 4:47
  • see my above comments – ateet Oct 14 '14 at 5:43
  • <asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server"> function PreSaveAction(){ code here -- } </asp:Content> – Sahul Hameed Oct 14 '14 at 8:48
  • this is how we have to write our code in content editor web part. ? – Sahul Hameed Oct 14 '14 at 8:49
  • OOTB means? I didnt get... – Sahul Hameed Oct 14 '14 at 8:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.