Page 1 of 1

Posting error message with redirect [solved]

Posted: Thu Mar 31, 2011 1:00 pm
by jeverd01
Is it possible to post an error message as a param? I know you can use 'module_message' for a success message, is there a similar param for error? I am aware of ShowErrors but this doesn't work with a redirect, and then I would have to pass the error message as a param anways well writing logic to see if it is set in the action anyways.


Also is there anywhere in the api doc that goes over all of the default $params array values?

???

Re: Posting error message with redirect

Posted: Fri Apr 01, 2011 3:53 pm
by kidcardboard
I've wondered this myself a few times (about the params anyways).

Re: Posting error message with redirect

Posted: Sat Apr 02, 2011 2:00 am
by Wishbone
ShowErrors works for me with a redirect..

Code: Select all

$params = array('tab_error'=> $this->Lang('errorupdatingdatabase'), 'active_tab' => 'articles');
$this->Redirect($id, 'defaultadmin', $returnid, $params);
..and in my defaultadmin:

Code: Select all

if ($params['tab_error']) {
  echo $this->ShowErrors($params['tab_error']);
}
It took me awhile to figure out that you had to 'echo' the ShowErrors() output.

Re: Posting error message with redirect SOLVED

Posted: Sun Apr 03, 2011 10:40 pm
by jeverd01
Awesome thanks for the help. Is there anywhere I can see all of the available params. I am still struggling with the documentation.

Re: Posting error message with redirect [solved]

Posted: Mon Apr 04, 2011 12:18 am
by Wishbone
I'm not sure what you mean by 'all the available params'. The only 'special' parameter that I know is 'tab_message'

Re: Posting error message with redirect [solved]

Posted: Thu Jun 02, 2011 12:03 pm
by Duketown
Thanks Wishbone for sharing this. Saved me hours to get it good.

Duketown