Search code examples
javascriptjqueryasp.netsharepointscriptresource.axd

Object doesn't support this property or method in ScriptResource.axd


I have a ASP.NET (SharePoint-Page) that contains a lot of non-server controls (as well as server controls) and also some jQuery - Magic.

I do NOT use any Ajax-Controls

All of a sudden I receive a JavaScript-Error from within the "Scriptresource.axd":

;if(a)this._updateControls(a,b,e,c,true)},_matchesParentIDInList:function(c,b){for(var a=0,d=b.length;a<d;a++)if(c.startsWith(b[a]+"_"))return true;return false},

"Object doesn't support property or method "startWith"

When I debug through the JS-Code, "c" is of type HTMLInputElement

Of course, "ScriptResource.axd" is some automatic generated code I cannot access myself What could have gone wrong there?


Solution

  • Using chromes Dev-Console and debugging wild I found the cause of this problem:

    I keep this, cause this is quite a good "Q&A"-Example I guess (If it hasn't been answered before)

    The problem was that I used a hidden field with the id "id";

    <input type="hidden" name="id" id="id" />
    

    SharePoint 2013 does not seem to like that (looks like it uses "id" itself) which causes the error. Renaming the id to something different:

    <input type="hidden" name="itemId" id="itemId" />
    

    solved the problem,