0

I have a SP.UI.ModalDialog. On the dialog there are two radio buttons:

  • Agree
  • Disagree

Then there is a submit button. The submit button checks to see what the value of the radio button is.

OnClick="if(document.getElementById('Agree').checked){var results ={result:'agree'};return SP.UI.ModalDialog.commonModalDialogClose(SP.UI.DialogResult.OK,results);}else{var results ={result:'disagree'};return SP.UI.ModalDialog.commonModalDialogClose(SP.UI.DialogResult.cancel,results)}">

Now I want to add a "Close dialog" button, that simply closes the dialog. I don't want it to return any results. How can I simply close the dialog?

The following is not working for me:

OnClick="window.frameElement.SP.UI.ModalDialog.commonModalDialogClose();"
JAck28
  • 899
  • 4
  • 15
  • 40
  • possible duplicate of [How to close SP.UI.ModalDialog from button click in sharepoint?](http://stackoverflow.com/questions/19320690/how-to-close-sp-ui-modaldialog-from-button-click-in-sharepoint) – Tiago Duarte Aug 01 '14 at 20:10

2 Answers2

0

For anyone referencing this question in the future, apparently the problem is internet explorer in my dev environment. Not sure if it's so much a browser issue as it is a dev environment issue, though. The same code works in QA with the same version of ie. Will have to investigate my browser settings further in my dev envrmnt.

JAck28
  • 899
  • 4
  • 15
  • 40
0

For what it is worth, I was also struggling with using a button to close a modal window. Passing null worked for me.

var _html = document.createElement();
_html.innerHTML = 'Something written in here <input type="button" value="Close" onClick="SP.UI.ModalDialog.commonModalDialogClose(1, null)">'
Josh Weston
  • 1,632
  • 22
  • 23