Project Description
A JavaScript module, using jQuery, for manipulating SharePoint form fields from the URL.


The SharePoint Form Field Assistant can be added to any new or edit form in SharePoint 2007. With SPFF loaded, you can manipulate form fields through query string parameters. Current manipulations supported: hide field, prepopulate field, prepopulate and lock field.

Getting Started

Add jQuery and spff scripts to a SharePoint page that also has one or more form controls. Add a document.ready instruction like the following:

Form Manipulations


Append the field's name, equal sign, and an underscore. Setting a field's value then hiding it is not supported. To prevent manipulations of a prepopulated field, see SPFF Options: lock.


Other methods for invoking spff include restricting the page type it applies to:

This script can be safely added to an entire site through the .master page. However, for individual form pages, use a Content Editor Web Part. To reach the Edit Page menus, append ?PageView=Shared&ToolPaneView=2 or &PageView=Shared&ToolPaneView=2 to the URL of the form page and navigate to the new URL. Add the CEWP with jQuery (if not already on the page) and the spff script.

To only load spff conditionally, based on user group, the MOSS version of the CEWP can make use of audience targeting. As a result, only the specified groups will process spff instructions in the URL.


To prepopulate a field, specify the field name, add an equal sign, and the field value. The script was tested with all out-of-the-box SharePoint controls in the latest versions of Firefox and Internet Explorer. By stringing together various query string parameters, one can send several instructions to the form prepopulating and hiding various fields.

The various data types have specific formats, see the individual data type examples below (some of the screen shots below use the "lock" option to clarify which fields have been manipulated, see SPFF Options: lock for more information):

/Lists/Tasks/NewForm.aspx?Title=this is a test of text field


Multiline Text, RTF, and HTML
/Lists/Tasks/NewForm.aspx?Title=_&Priority=_&Status=_&Description=<b>bold text test</b>


Note: When the lock option is used, the WYSIWYG editor is removed.


Choice Dropdown
/Lists/Tasks/NewForm.aspx?Priority=(1) High


People Picker
Multiple people may be assigned, separated by commas.


Dates can use slash, dot, or dash to separate M, D and YYYY.
/Lists/Tasks/NewForm.aspx?Start Date=1/31/2010&Due Date=02.1-2010


Date Time
Date follows the same rules of Date above, the time portion must be separated from the date by a space and in the h:mm am/pm format. Because SP only allows minutes in 5-minute intervals, minute values not found in the SP dropdown will default to 00.

/Lists/Custom%20List/NewForm.aspx?Date Time=1/1/2010 3:15 am


Checkbox (yes/no)
Possible values for a checkbox field are 1, true, TRUE, 0, false, FALSE.


Choice Checkbox
Values follow the same rules as Checkbox above but separate values must be listed in checkbox order separated by commas.
/Lists/Custom%20List/NewForm.aspx?Checkbox=_&Choice Checkbox=1,0,1


Choice Radio
Radio buttons are set by setting the value in the query string to the choice to be true/checked.
/Lists/Custom%20List/NewForm.aspx?Checkbox=_&Choice Checkbox=_&Choice Radio=2


Currency fields are merely text fields that validate numbers and displays the data in the currency format of choice.


Hyperlink and Picture
The URL and description are separated by a comma.


Lookup dropdown controls can be set by either the name of the option (it's text value) or the choice's ID. To specify the ID, use @ then the ID#.


Multi-choice Lookup
Values use the same formats as Lookup, above, but multiple values may be set separated by commas. ID values and text values can be mixed. If a text value matches multiple options, they will all be selected. While locked, more items may be added to the multi-select list but none can be removed.



SPFF Options

Default = false.
Once locked, any prepopulate instructions from the query string "locks" the target field(s). In most cases, the form field is not actually disabled (because that prevents the javascript submit action from collecting the values). Instead, the onchange event causes the spff to process again, collecting the query string parameters and prepopulating the field(s).


Default = "#ccc"
Sets the background color of the form field. This can be overridden.
$.spff({lock:true, lockColor:"#fff"});
$.spff({lock:true, lockColor:"white"});

Default = "background":"url('/_layouts/images/IMNDND.PNG') no-repeat right"
Sets the background style of the form field's container. This can be overridden.
$.spff({lock:true, lockBkg:{"background":"green"} });

Possible Uses for SPFF

Easier Creation of Child Items
Using a Data View Web Part, custom Content Query Web Part (MOSS only), Links list, Content Editor Web Part, or Calculated Column, I have been successful at creating links to target forms that include SPFF instructions to prepopulate a current list item's ID.

For example: To create a new Task based on an existing Issue, use your favorite technique to create a link to the Task List. At the end of your URL, append the name of the Lookup column that points to your Issues List followed by =@ and the ID value of the current item (or = and the Title value).

Last edited Jun 1, 2009 at 2:03 PM by AutoSponge, version 12