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 would like to have the following behavior. After clicking the submit button in a custom layout page, a dialog box opens showing the SPLongOperation page. After the operation is done my custom success page is shown in the dialog box.

My solution would have the following structure:

InputForm.aspx (Cust. App. page)
- with function OpenDialog() { options.url = '/_layouts/ProcessInputForm.aspx'; }
ProcessInputForm.aspx (Cust. App. page)
ProcessInputForm.aspx.cs With all the code that need to be executed in between the SPLongOperation statements

I'm only doubting how to transfer my form inputs. Do I need to pass them as parmeters of my OpenDialog() function or is there a better way?

share|improve this question
add comment

1 Answer

You can pass your parameters as querystring parameters. Inject your javascript with some server side code or try the following (not sure if that works though... haven't test it yet)

<script type="text/javascript"> 

   //Dialog opening 
   function OpenDialog() { 
    var options = SP.UI.$create_DialogOptions(); 
    options.url = "/_layouts/ProcessInputForm.aspx?Parameter1=<% GetParam1(); %>&Parameter2=<% GetParam2();"; 
    options.width = 500; 
    options.height = 400; 
    options.dialogReturnValueCallback = Function.createDelegate(null, CloseCallback); 
    SP.UI.ModalDialog.showModalDialog(options); 
    } 

var messageId; 

  // Dialog callback 
    function CloseCallback(result, target) { 
    if(result === SP.UI.DialogResult.OK) { 
        alert("OK was clicked!"); 
    } 
    if(result === SP.UI.DialogResult.cancel) { 
        alert("Cancel was clicked!");         
    } 
}

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.