merlinofchaos just added some new code to Ctools to allow its modals to trigger an event when closed, which made ctools dialogs work with WYSIWYG (see http://drupal.org/node/947676 and the patch http://drupal.org/files/issues/947676-wysiwyg-ctools-detach.patch). Is there a similar event that Dialog API fires when closed (say, prior to form submit)?

Comments

obrienmd’s picture

Err, I guess the event needs to fire before actual submit (or when the dialog is closed without submit). I got the submit side working with a hack, just to prove the concept:

Drupal.behaviors.wystest = function (context) {
      if ($(context).attr('id') == 'dialog-main') {

      $('form:not(.ctools-use-dialog-processed)', context)
        .submit(Drupal.wystestsubmit);
      }
}

Drupal.wystestsubmit = function () {
    for (var instanceName in CKEDITOR.instances) {
      CKEDITOR.instances[instanceName].destroy();
    }
    $('#dialog-main form:not(.ctools-use-dialog-processed)').submit(Drupal.Dialog.submitAjaxForm);
    $('#dialog-main form:not(.ctools-use-dialog-processed)').submit();
    return true;
}
obrienmd’s picture

After hacking away and thinking about this for a few days, perhaps the best way to attack this would be to implement CToolsDetachBehaviors prior to submitting a form from a dialog?

devin carlson’s picture

Issue summary: View changes
Status: Active » Closed (outdated)

Dialog 6.x is no longer supported.