0

I have added a pop up box containing another page on my SharePoint site and it works fine in Chrome. When I click the button to open it in IE 10, however, the page just reloads and no pop up box appears. When I look at the page with the developer tools it looks like the function is not even getting called. The block pop ups option is not checked so that is not the problem. Here is the code I am using, any thoughts as to why it wouldn't work in IE?

<button><a href="#" onclick="dialogfunction('/sites/SharePointInitiativeSandbox/Gatekeeper/_layouts/15/workflow.aspx?List={bc68b081-8590-477e-aff7-55b2b64ad3fb}&ID='); return false;" class="btn">Start Workflow</a></button>

<script type="text/javascript">
JSRequest.EnsureSetup();
var idValue = JSRequest.QueryString["ID"];
function dialogfunction(pageUrl) {

var options = { url: pageUrl + idValue, width: 800, height: 600 };

SP.SOD.execute('sp.ui.dialog.js', 'SP.UI.ModalDialog.showModalDialog', options);

}
</script>
1

You are using an anchor tag inside a button and thats why the page reloads without opening the pop up.

Modify your code like this:

<button onclick="dialogfunction('/sites/SharePointInitiativeSandbox/Gatekeeper/_layouts/15/workflow.aspx?List={bc68b081-8590-477e-aff7-55b2b64ad3fb}&ID='); return false;" class="btn">Start Workflow</button>
1

https://jsfiddle.net/kusqtgw1/

If you try it with a normal button, like I did in this JS-Fiddle, does it work? Because it doesn't even work with your button without SharePoint.

<input type="button" onclick="dialogfunction(...);return false;" class="btn" value="Start Workflow"/>
1

Use either of the following below. Don't put an anchor tag within the button tag.

<button type="button" onclick="SP.UI.ModalDialog.OpenPopUpPage('/sites/SharePointInitiativeSandbox/Gatekeeper/_layouts/15/workflow.aspx?List={bc68b081-8590-477e-aff7-55b2b64ad3fb}&ID=');" class="btn" >Start Workflow </button>

<input type="button" value ="Start Workflow" onclick="SP.UI.ModalDialog.OpenPopUpPage('/sites/SharePointInitiativeSandbox/Gatekeeper/_layouts/15/workflow.aspx?List={bc68b081-8590-477e-aff7-55b2b64ad3fb}&ID=');" class="btn" />

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.