Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Customising the CMS /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Intercepting popup (GreyBox) close events?


Go to End


1173 Views

Avatar
HansR

Community Member, 141 Posts

23 May 2012 at 9:30pm

Does anyone know of a method of intercepting the popup close event and cancelling it if need be?

I'd like to run a "has the form been modified" type check when the user clicks on the popup window's close button. Basically, I'd like to warn the user if he/she might be about to lose some work. Is this possible with the GreyBox javascript module? I've tried simply binding a handler to the GB_close element, which doesn't work. That's not too surprising, as GreyBox.jx has installed its own handler. I haven't found any mention of a hook that could be used in the GreyBox documentation, but am hoping that there still is a method of doing this.

Hans