Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

Problem closing a modal dialog in SharePoint 2013

$
0
0
I have an application page which is opened in a modal dialog in SharePoint. In this dialog I open a document with: createNewDocumentWithProgID 
and afterwards when I want to close the dialog there is a problem using the call: 
SP.SOD.execute('sp.ui.dialog.js', 'SP.UI.ModalDialog.commonModalDialogClose', 1, 'Selected');

The call itself works in some contexts when I use it with "SP.SOD.execute", but it always causes other javascript errors to be thrown, and these errors sometimes causes problems with the application page. Below are the error messages and code, but my question essentially is: What is causing javascript errors in SharePoint after the close modal javascript function is called?

The errors that occur in javascipts after commonModalDialogClose has been called are: 

Unhandled exception at line 4118, column 17 in http://sp2013server/_layouts/15/init.debug.js?rev=hd6vYIlQjxmYnM/9RloMJA==
0x800a138f - JavaScript runtime error: Object expected

The javascript code snippet which throws the error (in init.debug.js ?):

for (i = 0; i < am; i++) {
                sodDep = mll[i];
                if (!IsSodLoaded(sodDep) && (bSync || sodDep.state != Sods.loading)) {
                    LoadSodInternal(sodDep, bSync);
                }

And this error: 

Unhandled exception at line 1270, column 5 in http://sp2013server/_layouts/15/init.debug.js?rev=hd6vYIlQjxmYnM/9RloMJA==
0x800a138f - JavaScript runtime error: Unable to get property 'caller' of undefined or null reference

The javascript code snippet which throws the error (in init.debug.js ?):

function ULSOnError(msg, url, line) {
    return ULSSendExceptionImpl(msg, url, line, ULSOnError.caller);
}

The problem which sometimes occurs in the application page because of these javascript errors is that something in the page becomes null after the errors occur. And then a null reference exception is thrown and the dialog will not close, instead an error message is shown. The null reference exception is like this (could be that the web request has become null?): 

"Server Error in '/' Application. 
Object reference not set to an instance of an object. 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below."

Stacktrace: 

[NullReferenceException: Object reference not set to an instance of an object.]
   Microsoft.SharePoint.ApplicationRuntime.SPRequestModule.PostLogRequestHandler(Object oSender, EventArgs ea) +120
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +79
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +164

olha



Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>