How to Require a Unique Title in a SharePoint List

Posted: November 3, 2010 in SharePoint
Tags: , , , ,
Graphic which hints to Microsoft Windows

Image via Wikipedia

In this example, I am using –

First let me say, props to the SPServices developers. This is a great project and has become a necessity for my SharePoint development.

Goal – Require a unique title in a SharePoint list

This is helpful when you are using this list as a lookup value in another list or are using some other relational design.

*These steps may be slightly different depending on your configuration. This is a short and ‘to the point’ tutorial – let me know if there are some steps that would benefit from expansion.

  1. In SharePoint Designer, open the web site that contains the list you want to modify
  2. If you do not already have the JQuery and SPServices libraries installed, do this now.
    1. I usually create a ‘scripts’ folder in the root of the website, then create a ‘js’ folder, then upload my library files there.
  3. Next, find the list that you want to modify and expand it.
  4. Right click the “NewForm.aspx” and choose “New From Existing Page”
    1. This method automatically changes the list to use our new form
  5. In the source view of the Untitled page, find where you want to add the script tags.
    1. I usually add mine inside the main content placeholder.
  6. Paste the following  text inside your document –

    <script language="javascript" type="text/javascript" src="../../scripts/js/jquery.SPServices-0.5.7.min.js"></script>
    <script language="javascript" type="text/javascript" src="../../scripts/js/jquery-1.4.2.min.js"></script>
    <script language="javascript" type="text/javascript">
    $(document).ready(function() {
    columnStaticName: "Title",
    duplicateAction: 1,
    ignoreCase: "true",
    initMsg: "This value must be unique.",
    initMsgCSSClass: "ms-vb",
    errMsg: "This value is not unique.",
    errMsgCSSClass: "ms-formvalidation",
    completefunc: null
  7. **Be Aware**
    1. You may need to correct the path of the JS libraries.
      <script language="javascript" type="text/javascript" src="~YOUR-PATH/jquery.SPServices-0.5.7.min.js"></script>
    2. You may not need these script references if your master page references them. This all depends on your current configuration.
  8. Save the file in your list as “MyNewForm.aspx”
  9. Repeat from step 4, for the “EditForm.aspx” so the title uniqueness can be maintained during an edit process.
  10. Now access the ‘New’ button on your list; validation should stop you now from creating a duplicate title.
  11. Review the $().SPServices.SPRequireUnique documentation here to discover all the parameters/options.
  1. Very creative use of jQuery. MS should include this functionality out of the box.
    Waiting for more Sharepoint posts!

  2. Prateek Kulkarni says:


    In my application i want to check the Unique Project Name from the list when the user enter the Project name in Project TextBox . And this check should be done for the first time of insertion. Please tell me how can i achieve and i am very new to sharepoint . It could be my pleasure if u help me

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s