This project has moved. For the latest updates, please go here.

Object Error from WebPart

Apr 4, 2012 at 11:20 PM

Funny enough...used the old version that only required prototype.js and everything worked great.  :) Moved over to SPUtility.js and I am now receiving an Object Error when the NewForm1.aspx page loads.

1. Copied latest prototype.js and SPUtility.js to proper location.
2. Opened my custom NewForm1.aspx and edited the CEWP.
3. Apply - OK - Error.

I will say that I link to a js file instead of using the source editor - however, I have tried it both ways.  Also removed the CEWP and put a new one in...just in case.

If it is what's in the js file that I call up from the CEWP:

<script type="text/javascript" src="/sites/mysite/SiteAssets/prototype.js"></script>
 <script type="text/javascript" src="/sites/mysite/SiteAssets/SPUtility.js"></script>
 <script type="text/javascript">
function GetValueFromURL(queryParamName) {
     var queryParams = location.href.toQueryParams();
     if (queryParams != null && queryParams[queryParamName] != null) {
         return decodeURI(queryParams[queryParamName]);
     return null;
     try {
       var urlValue = GetValueFromURL('incomingID');
       SPUtility.GetSPField('Incoming ID').SetValue(urlValue).MakeReadOnly();
     } catch (ex) {

Any help is greatly appreciated!!!


Apr 5, 2012 at 2:40 AM

Sorry for that! We should be able to get this figured out. Just curious, which old version? It has always depended on prototype.js.

You could try adding the following right before "var urlValue..":


What browser are you using? I'd like to figure out which line it is failing on.

Apr 5, 2012 at 9:59 AM

My apologies...when I say "old" I meant old as in the script that worked with "only" prototype.js and did not require prototype.js and SPUtility.js.  The item that I am attempting to pre-pop is a drop down list.  Based on my research, your script (the one that uses both) is a little more versatile with regards to dd lists, etc.

That said...I added in the debug line and received an error that SPUtility could not find a field name "Incoming ID" on my form.  Whilst that is not the the name is indeed "Incoming ID".  After that, it throws the Object error.

Thanks again!


Apr 5, 2012 at 6:27 PM

Yep SPUtility.js definitely supports more and it should definitely work with a drop down Choice field. It sounds like prototype.js and SPUtility.js are getting loaded OK if the Debug statement worked.

Is this SharePoint 2007 or 2010? Has the list form been customized?

If possible, it would be helpful to include a screenshot of your form. I'd like to see the Incoming ID field.