SPUtility.js 0.8 and beyond!

Quick update to SPUtility.js today! I’ve added support for rich text fields, unchecking multi-select checkboxes, and choice fields with fill-in values. I also have some thoughts on future SPUtility.js updates.

Planned updates for SPUtility.js 0.4

SPUtility.js version 0.4 should be getting released soon (week or so??). I wanted to put a quick post out there to highlight some of the upcoming features and fixes.

A Simple AJAX App using SharePoint Web Services

In this era of Web 2.0 web applications, I think it was only a matter of time before I needed to investigate how I could apply AJAX to SharePoint. With a little JavaScript and SharePoint’s web services, you can build fancy apps that can easily be dropped into a document library. And after reading Glen Cooper’s blog post on the subject, I figured it was something definitely worth investigating.

I also took this opportunity to improve a process I have to do all the time: what are the internal column names in a list? To get the list information, I built a simple AJAX app that consumes the Lists.asmx web service. Please keep in mind that this code will have be uploaded into SharePoint in order to work (a document library will work) and will not run from your desktop.

Autopopulate a SharePoint Form from URL

November 10, 2010 update: I’ve posted the sequel to this post: Autopopulate a SharePoint Form from URL (with SPUtility.js). I highly recommend checking out the new and improved way using SPUtility.js!

This post builds off of my previous post about making fields read only. In this case, I needed to autopopulate the NewForm.aspx with a value that gets passed to the form via URL parameters.

Make a Text field read only on EditForm.aspx without SPD

November 10, 2010 Update: I’ve posted the sequel to this post: Autopopulate a SharePoint Form from URL (with SPUtility.js). The code below will not work in SharePoint 2013 so you should use SPUtility.js!

After looking at a couple of examples online, most of them require the use of SharePoint Designer to make a field read only (or to hide it). Here is a method to make a field readonly using only Prototype (javascript library) and a Content Editor Web Part

Using Prototype's Element.insert

Strangely, Prototype’s documentation for Element.insert does not have any examples, so I cooked something up quick: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Template</title> <script type="text/javascript" src="prototype.js"></script> <script type="text/javascript"> Event.observe(window, 'load', function() { // Using Element.insert to insert after, before, top, or bottom Element.insert($('para1'), { before: "<p>This is paragraph zero.</p>" }); Element.insert($('para1'), { after: "<p>This is paragraph two.</p>" }); // notice we have to insert using the content container Element.