[Solar-talk] _flash add_ok?

Jeff Surgeson solar at 3hex.com
Tue Aug 8 06:02:06 PDT 2006


> > In your add method's you set a _flash value after the save() like so
> > $this->_flash->set('add_ok', true) however appear to not do
> > anything with it.
> >
> > Is it there just in case, or does it have another purpose that I am
> > missing?
>
> What I'm *supposed* to be doing is checking that flash again in the
> following actionEdit() method, so that I can show an "add succeeded"
> message.  Am I not doing so?

No it would appear not, there are lots of references to _flash->set('add_ok', 
true) in most of your  try blocks in add methods but can find no edit methods 
or any other method that makes use of it.

Sorry the question was more to establish proper use of _flash()

What I was tying to do was on succesful save->() instead of just _redirect() 
to where ever give the user some feedback as to what happened, hence why I 
was playing with _flash().

What I ended up doing was creating a stub messages() method like the error() 
method and passing a messages[ ] and _forward() to message template as 
happens on with errors.

try{
	......... 
	......
	$item->save();
	 // what is this being used for?
	$this->_flash->set('add_ok', true);

	//success! redirect to nice message page
	$this->messages[ ] = $this->locale('TEXT_OK_PRODUCT_ADD');
	return $this->_forward('message');

} catch {

Without any _redirect() or _forward() a success "Saved" message appear at top 
of page, as part of the form level logic I assume, I was trying to tie that 
in with $this->_flash->set('add_ok', true); to produce a more elegant way of 
user feedback after form submission.

-- 
Jeff Surgeson / South Africa


More information about the solar-talk mailing list