Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I am using the SP.UI.ModalDialog to popup a custom form. The form uses an XSL stylesheet that uses the GenFireServerEvent to commit the data. This works correctly, but I want to close the popup once the data is saved. What do I need to do to modify this form to commit the data and close the dialog?

share|improve this question
add comment

1 Answer 1

up vote 4 down vote accepted

I am adding this so that others who stumble accross it might find it useful. I got this to work by adding a __redirect to the GenFireServerEvent like this: onclick="javascript: {ddwrt:GenFireServerEvent('__commit;__redirect={WhateverPage.aspx?IsDlg=5'})"

Then on this page add something like this:

_spBodyOnLoadFunctionNames.push("closeme");

function closeme() {
    tp1=window.location.toString();
    if (tp1.indexOf("IsDlg=5") > 0) { window.frameElement.commitPopup(); }
}

This is what I needed to make this work!

share|improve this answer
add comment

Your Answer

 
discard

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.