3

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?

1

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!");         
    } 
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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