Project Description
The purpose of this custom field is to render JavaScript (more specifically jQuery script) in a SharePoint list form. It replaces the need to add Content Editor Web Parts to a list form for client-side scripting, and uses the power of jQuery to enable wide-ranging changes.

What is Supplied?
The VS project builds two WSP files for the same field. The difference between the two is that one deploys the jQuery 1.3.2 minified library, and the other does not. This means:
  • If you are already using jQuery on your site, you can reference that existing library (or the one hosted at google)
  • If you do not yet have jQuery available on your SharePoint WFE servers, use the file named SPPlus.CustomField.JqueryScriptWithLibrary.wsp
Don't install both in the same farm!

Also supplied in the build are .bat deployment files that will install, uninstall or redeploy either of these solutions.

Development Notes
The code is supplied as a Visual Studio 2008 solution, targetted at .Net 3.0.

The build process uses a tweaked .csproj file as detailed in this post by Andrew Connell. It is necessary to install the Microsoft Cabinet SDK on your development machine for the build to work.

The build creates an install file, and copies the wsp files + deployment batch files to this folder.

No WSPBuilder or VSEWSS used to build the solution? Given that this is a simple solution with very few artifacts, and then I wanted the flexibility to build two different WSP files in the same process, I am happy to stay with the manual technique for this one.

Screenshots
The custom field has a custom editor that offers the following options:
jQueryScriptFieldEditor.png

As an example, I needed to enlarge the multiselect lookup select elements in the new and edit form (configuration shown in screenshot above). This is the form before adding the field with the custom jQuery:
MultiSelectLookupFieldOutOfTheBox.png

And here is the form after increasing the width of those SELECT elements:
MultiSelectLookupFieldWithWidthAdjustment.png

Last edited Apr 7, 2009 at 6:46 AM by smallsteps, version 4