setSystemMessage($message);
this function would set a session variable with the message.
Then create another function called ...
getSystemMessage()
This function will return the contents of the session variable and then unset it. If the session variable is not set it will return 0.
So in your controller you would setSystemMessage('Success!') then redirect to the same page.
Also in your controller before rendering the view you would do the following...
$systemMessage = $this->getSystemMessage();
if ($systemMessage !=0) {
if ($systemMessage !=0) {
$this->set('systemMessage', $systemMessage);
}In your view to that page you would have an if statement like the following...
if ( isset($systemMessage)) {
echo $systemMessage;
}
Style the system message by putting it within <div class="system_message"> or something similar.
echo $systemMessage;
}
You can create the same kind of functions for setErrorMessage and getErrorMessage and do the same thing in the controller/view. Then style it with <div class="error_message">
This will work just fine as I am doing something similar with another application using another framework. Using the session variable should clear any of the problems you were having.
On 5/20/06, josh southern <[EMAIL PROTECTED]> wrote:
The problem with redirect() is that the variable I use to display the
success message doesn't carry through. The problem with flash() is that
if a user looks away for a few seconds (let's say the phone rings, or
someone walks into the room), they miss the success message and it
creates confusion as to whether the form worked. Hence my solution of
displaying a message on top of a new, blank form. They're already used
to looking there because of the validation error messages, and if they
distracted for a few seconds, they don't miss the success message.
This worked fine before, and now with 1.0, it doesn't. Can't someone
tell me why, and if there is a way for me to code a work-around?
- unset($this->params['data']) Not Working??? josh southern
- Re: unset($this->params['data']) Not Workin... Armando Sosa
- Re: unset($this->params['data']) Not Wo... josh southern
- Re: unset($this->params['data']) No... AD7six
- Re: unset($this->params['data']... josh southern
- Re: unset($this->params['d... John Zimmerman [gmail]
- Re: unset($this->param... John Zimmerman [gmail]
- Re: unset($this->p... josh southern
- Re: unset($this->p... John Zimmerman [gmail]
- Re: unset($this->p... John Zimmerman [gmail]
- Re: unset($this->p... stephenrs
- Re: unset($this->p... John Zimmerman [gmail]
- Re: unset($this->p... AD7six
- Re: unset($this->p... AD7six
- Re: unset($this->p... John Zimmerman [gmail]
- Re: unset($this->p... stephenrs
- Re: unset($this->p... John Zimmerman [gmail]
- Re: unset($this->p... josh southern
- Re: unset($this->p... John Zimmerman [gmail]
