If a form action or $form['#redirect'] takes you to a tabbed panel-page, a drupal_set_message() will appear above your tabs. This is good, except that when you click another tab the set_message will not clear because you are issuing a callback.

Is it possible to turn off the callbacks in the tab links and make them do GETs?

Or is there another way I can get the drupal_set_message to clear? I'd really rather not redirect the form submissions to url outside of the tabbed pages.

The same issue exists with a validation error message.

Thanks for any help and great work on panels tabs!

Brian

Comments

bwood’s picture

It almost works to do something like this in template.php _phptemplate_variables():

if (stripos($vars['messages'], 'Your message has been sent.') !== false) {
      $msgs =  $vars['messages'];
      unset($vars['messages']);
      $vars['content']=str_replace('<div class="content">', '<div class="content">'.$msgs, $vars['content']);
}    

This sucessfully inserts the drupal_set_message output into the content div below the panels tabs. However, the message also appears above the tabs. (So the output of drupal_set_message gets rendered upstream from _phptemplate_variables.

I could override $form['redirect'] and send the form to a path defined in [mymodule]_menu(), and then process the form with a callback that doesn't use drupal_set_message, but which instead sets some other variable... The result of that would be that the success/validation message appears under the tabs on the target page. When you navigate to another tab you would not see the success/validation message. However when you navigate back to the target tab you would still see a "stale" message.

I decided to just redirect the form away from the panels tabs page.

frankcarey’s picture

A simpler method would be to hide any messages with js when clicking a tab. Any new messages would have to come from a page reload anyway. Popups api might also be helpful.

dawehner’s picture

i just wondering, whether it this is also if you use just "tabs" without the panels style.

wim leers’s picture

Status: Active » Closed (won't fix)

I'm with dereine here, I can't imagine that panels_tabs is responsible for this. It merely renders the content it gets inside something else, i.e. tabs. It doesn't touch the Forms API nor $_SESSION (which is where messages are stored).

You'll have to look elsewhere for the root of your problem.