--- automodal.module	2010-06-19 06:03:33.000000000 -0700
+++ automodal.module	(working copy)
@@ -43,6 +43,24 @@ function automodal_menu() {
 }
 
 /**
+ * Implementation of hook_form_alter()
+ */
+function automodal_form_alter(&$form, $form_state, $form_id) {
+  if ($_GET['automodal']=='true') {
+    // Name the form submit entry so it can easily be found and replaced
+    $form['#submit']['automodal'] = 'automodal_close_form_submit';
+  }
+}
+
+/**
+ * Implementation of hook_form_submit()
+ */
+function automodal_close_form_submit($form, &$form_state) {
+  modalframe_close_dialog();
+  return;
+}
+
+/**
  * Determine whether the current request is for a modalframe page.
  *
  * @return
--- automodal.js	2010-06-19 06:03:33.000000000 -0700
+++ automodal.js	(working copy)
@@ -6,6 +6,19 @@ Drupal.behaviors.automodal = function (c
 
   $.each(Drupal.settings.automodal, function(selector, settings) {
     $(selector +':not(.automodal-processed)', context).addClass('automodal-processed').each(function () {
+
+      // Allow for custom onSubmit handlers, but provide a default
+      if (!(settings.onSubmit)) {
+        settings.onSubmit = function (args, statusMessages) {
+          // Display status messages generated during submit processing.
+          if (statusMessages) {
+            // @todo: Allow a different content selector without overriding onSubmit, ala Popups UI
+            $('div.left-corner > div.clear-block:last').prepend('<div class="modal-messages"></div>');
+            $('.modal-messages').hide().html(statusMessages).show('slow');
+          }
+        };
+      }
+
       settings.url = $(this).attr('href') || '#';
 
       if (settings.url.indexOf('?') >= 0) {
