I want to have the initiation form inside a modal popup. Here's what I've figured out so far:

To open the form insisde a modal dialog, I've included this inside the "Navigatate to Url" in the custom action.

javascript:function openDialog() {  
    var options = { 
    url: "http://<server>/srd/Workflows/wf_lobEnd/wf_lobEnd.aspx",
    width: 800,
    height: 600,
    title: "User Story"

This works fine. Question is how to modify the wf_lobend.aspx form so that the popup closes, and the initiation form get submitted.

This is the javascript that gets generated for me behind the ok buttun of the initiation form:

            <input type="button" value="Start" name="btnSave" onclick="javascript: {ddwrt:GenFireServerEvent(concat('__insert;__commit;__redirectsource;__redirectToList={',ddwrt:EcmaScriptEncode($ListName),'};'))}" />

That is a bit cryptic to me, so I'm not sure what to replace. I know that I must use something like this to get the dialog closed, but that does not seem to submit the form:

onclick="SP.UI.ModalDialog.commonModalDialogClose(SP.UI.DialogResult.OK, 'Ok clicked'); return false;"

Question is: How to close the dialog and still post the data?

(or maybe I've take the complete wrong approach, in case please let me know)





I have done something similar, starting a workflow from a modal dialog. The form that i used does not have any fields, but it still posts back and starts the workflow.


The code i used to open the dialog is this

    dialogReturnValueCallback: function(dialogResult, returnValue) { 

Try adding the dialogReturnValueCallback property to the open dialog options. I did not have to modify any of the automatically generated dialog button javascript.


Though looking at the page source i did have to do something extra to get it to redirect


if (Request["IsDlg"] == "1") {
    Context.Response.Write("<script type='text/javascript'>window.frameElement.commitPopup();</script>");
} else {
    SPUtility.Redirect(list.DefaultViewUrl, SPRedirectFlags.UseSource, Context);
  • Hi! Thanks for the feedback. But I still don't understand how to get the data posted? If I use the default implementation, I get a error saying "The data source control failed to execute the insert command". The script the gets exceuted is the same: javascript: __doPostBack('ctl00$PlaceHolderMain$InitiationForm$ctl01','__insert;__commit;__redirectsource;__redirectToList={{2ff87457-1767-4402-b04f-a28d841b40be}};') Any idea what causing this? – Larsi Jan 11 '11 at 11:14
  • In your form wf_lobEnd.aspx, how are you creating the Save button? My forms looks like this <input type="submit" class="ms-ButtonHeightWidth" id="ctl00_PlaceHolderMain_ButtonOk" value="Ok" name="ctl00$PlaceHolderMain$ButtonOk"> – djeeg Jan 11 '11 at 12:12
  • Save button is created with xslt using this magic code: <input type="button" value="Start" name="btnSave" onclick="javascript: {ddwrt:GenFireServerEvent(concat('__insert;__commit;__redirectsource;__redirectToList={',ddwrt:EcmaScriptEncode($ListName),'};'))}" /> – Larsi Jan 11 '11 at 14:35
  • Did you create the page wf_lobEnd.aspx or was it generated from something? What webparts are on it? Or is it an InfoPath form? – djeeg Jan 11 '11 at 14:53
  • It's generated from SD Sharepoint WF designer. It has a DataFormWebPart on it. – Larsi Jan 13 '11 at 7:51

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.