For instructions on how to install SPUtility.js, see Installation.
Here is a complete hello world example:
<script src="//ajax.aspnetcdn.com/ajax/jQuery/jquery-1.11.2.min.js"></script>
<script src="/[change to your subsite]/SiteAssets/sputility.min.js"></script>
<script>
// wait for the window to load
$(document).ready(function () {
// EXAMPLE: Set the value of the Title field to Hello world!
SPUtility.GetSPField('Title').SetValue('Hello world!');
});
</script>
You could upload this as a HTML file into your SiteAssets library alongside sputility.min.js (adjust src paths as necessary).
For general usage information, see functions and properties common to all fields (regardless of type)
Here is a list of all the supported field tables and the various way they are displayed in SharePoint. SPUtility.js does all the hard work of figuring out to show/hide, get/set values, and make them read only!
Type | SP Type | Field Configuration | Supported? |
All Field Types Documentation | |||
Single line of text | SPFieldText | Yes | |
Multiple lines of text |
SPFieldNote |
Plain text |
Yes |
Rich text (Bold, italics, text alignment) |
Yes | ||
Enhanced rich text (Rich text with pictures, tables, and hyperlinks) |
Yes | ||
Choice (menu to choose from) | SPFieldChoice | Drop-Down Menu | Yes |
Drop-Down Menu with fill in value | Yes | ||
Radio Buttons | Yes | ||
Radio Buttons with fill in value | Yes | ||
SPFieldMultiChoice | Checkboxes (allow multiple selections) | Yes | |
Checkboxes (allow multiple selections) with fill in value | Yes | ||
Number (1, 1.0, 100) | SPFieldNumber | Yes | |
Content Type (as of v0.9.1) | ContentTypeChoice | ||
Currency ($, ¥, €) | SPFieldCurrency | Yes | |
Date and Time | SPFieldDateTime | Date Only | Yes |
Date & Time | |||
Lookup (information already on this site) | SPFieldLookup | Allow multiple values = No Less than 20 values in the lookup list, displays as a dropdown using a SELECT. |
Yes |
Allow multiple values = No If 20 or more values, displays as an autocomplete using a text INPUT. |
Yes | ||
SPFieldLookupMulti | Allow multiple values = Yes (displays as two list boxes) | Yes | |
Yes/No (check box) | SPFieldBoolean | N/A | Yes |
Person or Group | SPFieldUser | Allow multiple selections: No | Yes |
SPFieldUserMulti | Allow multiple selections: Yes | Yes | |
Hyperlink or Picture | SPFieldURL | Yes | |
Name column in a Document Library | SPFieldFile | Yes | |
Rating Scale (a matrix of choices or a Likert scale) | SPFieldGridChoice | No | |
All Day Event | SPFieldAllDayEvent | Calendar field. Checking the box causes a page postback and changes the Start and End Time fields to have a date portion only. | No |
Recurrence | SPFieldRecurrence | Calendar field. Checking the box causes a page postback in order to display controls to setup Daily/Weekly/Monthly/Yearly recurrence. | No |
Workspace | SPFieldCrossProjectLink | Similar to a yes/no field. Checking yes and then clicking Save will take you to a New Meeting Workspace page. | No |
Notice a field that isn't listed? Let me know! |
Tested with SharePoint 2007 and the field types above. Untested with other field types.
Useful links: