1

Is it possible to restrict, creation of duplicate list item in the Sharepoint 2007, using Javascript in content editor webpart to validate when an list item is added?

  • Are you trying to have a unique column in the list item. How does this CEWP come into picture. Can you ellaborate the scenario? – Thomson Sep 9 '10 at 6:50
  • I have a list, whenever an item is added to this list, the title should be unique; there shouldn't be list items with same title.. – Anonymous Sep 9 '10 at 7:04
  • i understood the above , What are you trying to achieve using CEWP? – Thomson Sep 9 '10 at 8:00
  • Custom code is the only way to guarantee this. JavaScript can be disabled or altered. – Alex Angas Sep 24 '10 at 1:59
1

You can use the list web service via JavaScript/jQuery and validate if an item exists. I would prefer doing this on an event recevier (lot easier) but I guess you don't have a access to deploy code ? here are some samples using JS http://darrenjohnstone.net/2007/05/28/querying-a-sharepoint-list-with-JavaScript/ and here using jQuery http://weblogs.asp.net/jan/archive/2009/04/09/calling-the-sharepoint-web-services-with-jquery.aspx

0

It wouldn't be trivial, but you can use javascript to carry out a web service call to lookup all items with the same title.

Have a look at the SPServices JavaScript library on CodePlex.

Your Answer

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