Sharepoint works as follows...
onload="javascript:if (typeof(_spBodyOnLoadWrapper) != 'undefined') _spBodyOnLoadWrapper();",
So if one would like to execute some function onload of a page... doing so:
window.onload = function()
would really cause him trouble since he'll overwrite the sharepoint function calls...
So the smart way of doing this is to use:
_spBodyOnLoadFunctionNames.push('myFunction_01');
_spBodyOnLoadFunctionNames.push('mySecondFunction');
Reference: http://blogs.tamtam.nl/mart/UsingWindowonloadInSharePointPages.aspx
Thank you, thank you, thank you!!!!!!!!!!!!!!! converted to 2010 and could no longer open Infopath form with createNewDocumentWithRedirect because javascript used window.onload to call function. Replaced window.onload with _spBodyOnLoadFunctionNames.push and presto!!!!
ReplyDelete