diff --git a/dialog.js b/dialog.js
index 4b916fc..b06f4d6 100644
--- a/dialog.js
+++ b/dialog.js
@@ -71,6 +71,17 @@ Drupal.ajax.prototype.commands.dialog_display = function(ajax, response, status)
     });
   }
 
+  // Apply the click events on the buttons.
+  var buttons = element.dialog('option', 'buttons');
+  jQuery.each(buttons, function(button, options) {
+    if (options['data-dialog-id'] || false) {
+      options['click'] = function() {
+        var id = options['data-dialog-id']; // @TODO: Fix the click event?
+        $('#' + id).mousedown();
+      };
+    }
+  });
+
   // Apply any settings from the returned JSON if available.
   var settings = response.settings || ajax.settings || Drupal.settings;
   // Process any other behaviors on the content, and display the dialog box.
diff --git a/dialog.module b/dialog.module
index 6b11ffe..efda0cc 100644
--- a/dialog.module
+++ b/dialog.module
@@ -184,6 +184,16 @@ function dialog_command_loading() {
  *   for available options.
  */
 function dialog_command_display($content, $options = array()) {
+  // Turn the form actions into dialog buttons.
+  if (isset($content['actions'])) {
+    foreach (element_children($content['actions']) as $index => $name) {
+      $options['buttons'][$name] = array(
+        'text' => $content['actions'][$name]['#value'],
+        'data-dialog-id' => $content['actions'][$name]['#id'],
+      );
+    }
+    $content['actions']['#attributes']['class'][] = 'js-hide';
+  }
   return array(
     'command' => 'dialog_display',
     'content' => render($content),
diff --git a/modules/dialog_user/dialog_user.module b/modules/dialog_user/dialog_user.module
index 8f0120d..79fbb3d 100644
--- a/modules/dialog_user/dialog_user.module
+++ b/modules/dialog_user/dialog_user.module
@@ -91,7 +91,7 @@ function dialog_user_form_alter(&$form, &$form_state, $form_id) {
         }
       }
 
-      $form['submit']['#ajax'] = array(
+      $form['actions']['submit']['#ajax'] = array(
         'callback' => 'drupal_render',
         'wrapper' => 'dialog-form-wrapper',
       );
