Using the Forward module in a popup window (Lightbox 2); when I submit the post, the page I *was* on will appear in the popup window. Instead of this, I want to show a different node - a thank you page asking them to close the window to continue. (A modal dialog box doesn't work - we've tried).

The override I'm trying to use (in template.php) is as follows;

function phptemplate_form_forward_alter(&$form, &$form_state) {
$form['#redirect'] = 'node/337';
/* After the form is submitted, redirect the user to an innocuous page.*/

}

Node 337 is the 'Thank you' window, but non of this code seems to run. I tried to put it in a module as well, but no difference (apart from the prefix of the function name)

I'm sure it's a schoolboy error - but where?

Regards,

Pete.

Comments

timeril’s picture

Hi Pete - how did you end up solving this? We've got the exact same issue.

Thanks!

sh.manishshukla’s picture

Hi,

I wrote my own js submit instated forward_js_submit()

Eg:

 function my_forward_alter() {
if (variable_get('forward_colorbox_enable', 0) && isset($_GET['overlay']) && ($_GET['overlay'] == 'cboxnode')) {
      $form['#prefix'] = '<div id="cboxNodeWrapper">';
      $form['#suffix'] = '</div>';
      $form['actions']['submit']['#id'] = 'cboxSubmit';
      $form['actions']['submit']['#ajax'] = array(
        'callback' => 'my_forward_forward_js_submit',
        'wrapper' => 'cboxNodeWrapper',
        'method' => 'replace',
        'effect' => 'fade',
      );
    }
}

function my_forward__forward_js_submit($form, &$form_state) {
  // If there were errors, need to re-display the form
  if (form_get_errors()) {
    return $form;
  }

  // Notify next page that a message is waiting - this is needed because Ajax can't set the message queue
  $recipient_list = forward_recipient_list($form_state);
  $_SESSION['forward_message_pending'] = $recipient_list['token'];

  // Form passed validation, so redirect to a good landing page
  $markup = '
    <script type="text/javascript">
      (function ($) {
        $(document).ready(function() {
          $.fn.colorbox.close();
        });
      })(jQuery);
    </script>';
  // Return our markup.
   $confirmation = array(
     '#type' => 'markup',
     '#markup' => $markup,
   );
   return $confirmation;
}