0

I have a SP UIModal Pop-Up, in which I have a javascript code with alert. When I click OK in my alert, my pop-up should close...

Currently , I am closing the alert message, then I need to close the model dialog using the close [X] button. But my requirement is that the model dialog should close automatically once my alert is closed.

1
  • How to show alert when user click on close [X] ? can you share this logic?
    – Admin
    Commented Sep 7, 2016 at 6:14

2 Answers 2

0

Add one of these functions after your alert:

window.frameElement.commitPopup() //passes SP.UI.DialogResult.OK back
window.frameElement.cancelPopUp() //passes SP.UI.DialogResult.Cancel back
4
  • Thanks . But this option is working fine only in IE 8 + & Mozilla Firefox , but not in Chrome & Safari. As MS prescribes only IE ,I'm escaped. Is there any workaround to make it work for Chrome ? Commented Sep 6, 2016 at 14:32
  • Hmm that's strange. Just tested it in Chrome 52 and it works. Can't test Safari, though. Maybe there's another issue with your code. Commented Sep 6, 2016 at 15:23
  • If my code is having any other issue then how could it work perfectly in IE & Firefox ?? Also I had given alerts in ExecuteQueryAsync(); both succeeded & Failed.. When I run in chrome , my Query is failing and the alert under failed() is displayed.. But not in IE ...!!!! Miraculous Issue :D Commented Sep 6, 2016 at 15:27
  • How about you provide your code and I'll have a look at it? Commented Sep 6, 2016 at 15:30
0

Inspect the element close[X], find the Id and call click event using jquery. Something like

$('a[id="elementId"]').click();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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