1 minute read
This release contains two functions I’ve wanted to get into the library for a long time: $().SPServices.SPRedirectWithID and $().SPServices.SPRequireUnique. These two functions show how you can solve tricky problems with jQuery and the SharePoint Web Services much better than any of the other approaches available, IMHO.
$().SPServices.SPRequireUnique allows you to specify a page to redirect to after creating a new list item with a NewForm.aspx (or your customization of it). The two posts discussing this topic on my blog are together the #1 most read by a long shot. (You can read these two old posts: Redirect to Another Page from NewForm.aspx with the New Item’s ID: Redux and Redirect to Another Page from NewForm.aspx with the New Item’s ID to see where my thinking used to be.)
$().SPServices.SPRequireUnique lets you require unique values in a Single line of text column. Generally you would use this on the Title column so that you can use a reference list relationally, such as the lists I use in the examples for $().SPServices.SPCascadeDropdowns to contain the States and Regions.
The release is rounded out with a couple of new Lists Web Service operations (CheckInFile and CheckOutFile) and exposing a couple of the nifty “utility” functions ($().SPServices.SPGetLastItemId and $().SPServices.SPSPGetDisplayFromStatic) I wrote in the process of building the first two functions above.
You can download jQuery Library for SharePoint Web Services from Codeplex.
|$().SPServices.SPRedirectWithID||This function allows you to redirect to a another page from a new item form with the new item’s ID. This allows chaining of forms from item creation onward.|
|$().SPServices.SPRequireUnique||Checks to see if the value for a column on the form is unique in the list.|
|$().SPServices.SPGetLastItemId||Function to return the ID of the last item created on a list by a specific user. Useful for maintaining parent/child relationships.|
|$().SPServices.SPSPGetDisplayFromStatic||This function returns the DisplayName for a column based on the StaticName.|
|Web Service||Operation||Options||MSDN Documentation|
|Lists||CheckInFile||pageUrl, comment, CheckinType||Lists.CheckInFile Method|
|CheckOutFile||pageUrl, checkoutToLocal, lastmodified||Lists.CheckOutFile Method|