Posting error message with redirect [solved]

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
jeverd01
Forum Members
Forum Members
Posts: 20
Joined: Thu May 20, 2010 2:00 am

Posting error message with redirect [solved]

Post 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?

???
Last edited by jeverd01 on Sun Apr 03, 2011 10:41 pm, edited 1 time in total.
User avatar
kidcardboard
Forum Members
Forum Members
Posts: 54
Joined: Mon Sep 28, 2009 5:25 pm

Re: Posting error message with redirect

Post by kidcardboard »

I've wondered this myself a few times (about the params anyways).
Wishbone
Power Poster
Power Poster
Posts: 1368
Joined: Tue Dec 23, 2008 8:39 pm

Re: Posting error message with redirect

Post 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.
jeverd01
Forum Members
Forum Members
Posts: 20
Joined: Thu May 20, 2010 2:00 am

Re: Posting error message with redirect SOLVED

Post 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.
Wishbone
Power Poster
Power Poster
Posts: 1368
Joined: Tue Dec 23, 2008 8:39 pm

Re: Posting error message with redirect [solved]

Post by Wishbone »

I'm not sure what you mean by 'all the available params'. The only 'special' parameter that I know is 'tab_message'
Duketown

Re: Posting error message with redirect [solved]

Post by Duketown »

Thanks Wishbone for sharing this. Saved me hours to get it good.

Duketown
Post Reply

Return to “Developers Discussion”