Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SharePoint 2010: JavaScript error when creating Modal Dialog?

Tags:

For some reason, my SharePoint's modal dialog doesn't work properly. The error I get is this:

  • In Firefox: SP.UI.$create_DialogOptions is not a function
  • In IE: Object doesn't support this property or method

Here is my code:

var options = SP.UI.$create_DialogOptions();
options.width = 525;
options.height = 300;
options.url = '/_layouts/mywork/richtexteditor.aspx';
options.dialogReturnValueCallback = Function.createDelegate(null, function (result, value)
{
    alert(result + value);
});

SP.UI.ModalDialog.showModalDialog(options);

Interestingly, when I inspect the SP.UI in Firebug, I don't see all the methods and properties.

NOTE: I am using standard Webpart (not visual) and not an application page.