SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have problems with multiple modal dialogs using IE 9 browser. When I click on the Ok or Cancel button on the second modal form, I get following exception from my js code.

when I try once again to press Ok or Cancel button I get

It works fine on Chrome and Firefox.

on my first dialog I have a link button and this fires a standard js function

function AddContributor(id) {

    var currentUrl = window.location.href;
    currentUrl = currentUrl.substring(0, currentUrl.lastIndexOf('/') + 1);

    var options = SP.UI.$create_DialogOptions();
    options.url = currentUrl + "/SecondPage.aspx?id=" + id;
    options.title = "Add";
    options.width = 700;
    options.height = 600;
    options.dialogReturnValueCallback = AddContributorCallback;


function AddContributorCallback(dialogResult, returnValue) {
    if (dialogResult == SP.UI.DialogResult.OK) {
    if (dialogResult == SP.UI.DialogResult.cancel) {
share|improve this question

first looking at your code you have taken the if statment out of the try catch block where it should be inside the try block so you can catch the error when debugging.

The next issue is that it returning null, probably because its out of the try catch block and/or the object doesnt exist in that time when your clicking on it so your calling somthing (object) that hasnt been created yet or has been desposed off causing it to be null.

as i cant properly see a part of the code that could be causing it I can only speculate that you have click on the first modal which runs fine but then on the second one it throws the error as it doesnt exist what your calling or the code that its failing on is not in the right place!

hope this helps :)

share|improve this answer
Thanks for your reply. The code you have seen is not my code. It's standard sharepoint modal-dialog js. – aph5 Sep 24 '12 at 13:23
ok no problem, so how did you add the dialog? – ali Sharepoint Sep 24 '12 at 13:27
I have updated my question above. – aph5 Sep 24 '12 at 13:44

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.