Sunday, March 30, 2014

jQuery-Script only working when WebPart is in Edit Mode

Hi there,



so I developed some custom functionality with SPServices that works fine in my dev-environment. Now Im trying to deploy it in the productive environment and Ive struggled for several hours but cant get it to work.


This is my code: http://ift.tt/1gSgAMX


I insert the code inside of a simple form webpart.

When the webpart / website is in edit mode, the code executes fine.

When its not in edit mode, the jquery functions work, but the spservices functions do not seem to work. I get the error "Das Objekt unterstützt diese Eigenschaft oder Methode nicht." (in english its something like "The object does not support this property or method."). Line number of the error then points to the first occurrence of $.SPServices(). (Firefox Screenshot of Console: http://ift.tt/1pwJ1B8)



I searched nearly the whole Internet and tried different solutions.

I wrapped the $(document).ready(function() {}) like this: ExecuteOrDelayUntilScriptLoaded(function() {}, "sp.js");



And I tried writing the code directly to the webpart page via sharepoint designer. It does not work then either and I even cant enter edit mode.


I found out, that the masterpage-Template is also referencing a jQuery-Instance (v 1.4.2), so I tried disabling the reference in my script, but the result is the same.


I also tried referencing the scripts via absolute URLs, without success.


The references to the scripts seem to work (I can click them in sharepoint designer). I just dont know why it is not working. If you have any further suggestions or have any idea how to tear this problem down, or find out whats maybe causing it, please let me know because Im really clueless right now...



Thank you very much!



No comments:

Post a Comment