This functionality can be achieved without writing any new functions.
I'm building a similar app designed for rapid data input, and my needs
are similar to yours. I didn't like the flash() function either, but
(as described above) the following works just fine for displaying a
message at the top of a new empty form:

$this->Session->setFlash ("Your enhancement has been saved, Go on, add
another one!");
$this->redirect ($this->controller/action);

Why write a new status message handling mechanism when one already
exists in Cake (the flash message)? Doing it this way also means you
don't have to do anything to your view.

I also go a bit further, because sometimes my users want to save, then
fill out a new form which gets input which is very similar to the one
they just saved. For this I just do the save, set the flash session
variable to my message, unset the hidden variable
$this->params['data']['id'], and let the rest of $this-params['data']
fall through to the new form - prefilled for them.

I'm very new to Cake and this forum, so please be easy on me if I'm
missing something.

Thanks.

X-Google-Language: ENGLISH,ASCII-7-bit
Received: by 10.11.53.63 with SMTP id b63mr108369cwa;
        Sun, 21 May 2006 14:43:56 -0700 (PDT)
X-Google-Token: CPrwZAwAAABYAEzqRWqvUVzA2zj5_XCL
Received: from 24.199.110.213 by j33g2000cwa.googlegroups.com with HTTP;
        Sun, 21 May 2006 21:43:56 +0000 (UTC)
From: "stephenrs" <[EMAIL PROTECTED]>
To: "Cake PHP" <[email protected]>
Subject: Re: unset($this->params['data']) Not Working???
Date: Sun, 21 May 2006 14:43:56 -0700
Message-ID: <[EMAIL PROTECTED]>
In-Reply-To: <[EMAIL PROTECTED]>
References: <[EMAIL PROTECTED]>
   <[EMAIL PROTECTED]>
   <[EMAIL PROTECTED]>
   <[EMAIL PROTECTED]>
   <[EMAIL PROTECTED]>
   <[EMAIL PROTECTED]>
   <[EMAIL PROTECTED]>
   <[EMAIL PROTECTED]>
   <[EMAIL PROTECTED]>
   <[EMAIL PROTECTED]>
   <[EMAIL PROTECTED]>
User-Agent: G2/0.2
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.3) 
Gecko/20060426 Firefox/1.5.0.3,gzip(gfe),gzip(gfe)
Mime-Version: 1.0
Content-Type: text/plain

This functionality can be achieved without writing any new functions.
I'm building a similar app designed for rapid data input, and my needs
are similar to yours. I didn't like the flash() function either, but
(as described above) the following works just fine for displaying a
message at the top of a new empty form:

$this->Session->setFlash ("Your enhancement has been saved, Go on, add
another one!");
$this->redirect ($this->controller/action);

Why write a new status message handling mechanism when one already
exists in Cake (the flash message)? Doing it this way also means you
don't have to do anything to your view.

I also go a bit further, because sometimes my users want to save, then
fill out a new form which gets input which is very similar to the one
they just saved. For this I just do the save, set the flash session
variable to my message, unset the hidden variable
$this->params['data']['id'], and let the rest of $this-params['data']
fall through to the new form - prefilled for them.

I'm very new to Cake and this forum, so please be easy on me if I'm
missing something.

Thanks.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~----------~----~----~----~------~----~------~--~---

Reply via email to