e.g. When logging in through dialog, you don't always want to immediately close the dialog, but perhaps display a message. The problem is that if you hit the 'close dialog' or 'x' rather than hitting a submit button which includes a closing the dialog command, the page doesn't refresh and your 'login' and 'register' links are still there, rather than being replaced with 'my account'.

So, a solution is to include a command dialog_command_refresh_on_close() that forces a page refresh on dialog close.

CommentFileSizeAuthor
patch_commit_39205e055f0b.patch1.34 KBmoonray

Comments

drewish’s picture

Status: Needs review » Needs work

I don't think we need to explicitly compare it to true:

+        if (Drupal.Dialog.dialog.refreshOnClose == true) {

Just using if (Drupal.Dialog.dialog.refreshOnClose) seems like it would be fine.

Spelling:

+   * AJAX responder command to force page refresh on dialof close.
fortis’s picture

you can use remove event on dialog

(function ($) {
  if (Drupal.Dialog.dialog != undefined) {
    Drupal.Dialog.dialog.bind('remove', function () {
      window.location.reload();
    });
  }
})(jQuery);
becometa’s picture

Issue summary: View changes

is there any 7.v version of this?

devin carlson’s picture

Status: Needs work » Closed (outdated)

Dialog 6.x is no longer supported.