This project has moved and is read-only. For the latest updates, please go here.

SPSUtility urlParam not passing to NewForm

Nov 10, 2015 at 9:08 PM
Edited Nov 10, 2015 at 9:17 PM
Trying to pass StaffingType through the URL to NewForm.aspx but no value is passed. The field remains blank (if no default is selected) or as the default value. I have referenced SPUtility and Jquery. StaffingType is a text field (I have also tried using lookup fields and choice fields).

I appended &StaffingType=AF910 on the end of the URL.
<script type="text/javascript">
var urlParams;
(window.onpopstate = function () {
    var match,
        pl     = /\+/g,  // Regex for replacing addition symbol with a space
        search = /([^&=]+)=?([^&]*)/g,
        decode = function (s) { return decodeURIComponent(s.replace(pl, " ")); },
        query  =;
    // fix for sharepoint 2013 URLs which use the hash
    if (query === '') {
        query = window.location.hash.substring(window.location.hash.indexOf('?'));
    query = query.substring(1);
    urlParams = {};
    while (match = search.exec(query))
       urlParams[decode(match[1])] = decode(match[2]);
// wait for the window to load
$(window).load(function () {
    try {
        var urlValue = urlParams['StaffingType'];
    } catch (ex) {
The code is a word from word copy from your previous examples and simply changed the urlValue and SPField. StaffingType is both the display name and internal name.
Nov 10, 2015 at 10:43 PM
I will take a look.
Nov 16, 2015 at 12:03 AM
I copied the code you're using and was able to get this working with a single line of text field. Are you able to check SPUtility.js and jQuery are loaded ok? Have you disabled MDS on the site?

You could try the Getting Started example to just prove out everything is working ok:

There is some more troubleshooting information located here:
Hopefully this helps,