It would be nice to have support for a regular drupal success message rather than having to show a whole new page. Allowing this option makes for nice integration with AJAX forms. I have created a patch to get this working on my site. Patch is against 6.x-2.3:

--- webform.module.old  2008-10-14 18:51:42.000000000 -0300
+++ webform.module      2008-11-25 13:05:13.000000000 -0400
@@ -649,7 +649,7 @@
   $form['webform']['settings']['confirmation'] = array(
     '#type' => 'textarea',
     '#title' => t("Confirmation message or redirect URL"),
-    '#description' => t("Message to be shown upon successful submission or a path to a redirect page. Redirect pages must start with <em>http://</em> for external sites or <em>internal:</em> for an internal path. i.e. <em>http://www.example.com</em> or <em>internal:node/10</em>"),
+    '#description' => t("Message to be shown upon successful submission or a path to a redirect page. Preface message with <em>message:</em> for a simple message that does not require a page refresh. Redirect pages must start with <em>http://</em> for external sites or <em>internal:</em> for an internal path. i.e. <em>http://www.example.com</em> or <em>internal:node/10</em>"),
     '#default_value' => $node->webform['confirmation'],
     '#cols' => 40,
     '#rows' => 10,
@@ -1814,6 +1814,11 @@
     $path = preg_replace('/^internal:/', '', $node->webform['confirmation']);
     $redirect = array(trim($path), 'sid='. $sid);
   }
+  elseif (preg_match('/^message:/', $node->webform['confirmation'])) {
+    $message = preg_replace('/^message:/', '', $node->webform['confirmation']);
+    drupal_set_message(t($message));
+    $redirect = NULL;
+  }
   else {
     $redirect = array('node/'. $node->nid .'/done', 'sid='. $sid);
   }
CommentFileSizeAuthor
webform.module.patch1.46 KBemilymoi

Comments

quicksketch’s picture

Status: Active » Needs review

Nice, I like it. I'll review this when I get a chance and put it in.

quicksketch’s picture

Status: Needs review » Fixed

Thanks! I put it in as-is except I removed the t() function from around the message. If using multiple languages each message should be translated by i18n or translation module as you translate the node (despite Webform not directly supporting i18n :P). Thanks again!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.