Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

javascript to prevent item being created if it already exists

$
0
0

I have a list which has a Person column. When I am on the NewForm.aspx and if I enter a person's name in the column and click on Save, the javscript on the page should allow me to save the item only if there does not exist an item in the list having that person already. I cannot use workflow or event receiver for this , only javascript.

For this, in the PreSaveAction, I am using rest api, e.x. $filter=(Person eq 1),where 1 is the user id. Now the question is how do I get the user id of the person in the newform PreSaveAction ,after user enters it. I examined the html generated after the user is entered in the Person column, but I could not find any user id. How can I solve this using javascript?


Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>