If $this->data is set then the form fields should be re-populated when
the view is rendered again. Just make sure you don't change that
variable in your controller action. Here's a basic example:
public function admin_add()
{
if (!empty($this->data))
{
if ($this->Post->save($this->data))
{
$this->flash(
'The Post was saved',
array(redirect somewhere)
);
}
else
{
/* $this->data remains unchanged, so FormHelper will
fill in the fields
*/
$this->flash('not saved, try again');
}
}
}
On Thu, Feb 12, 2009 at 2:37 PM, Abhishek <[email protected]> wrote:
>
> Hi,
> After form submission, say it fails for some reason .. am not using
> the validation rules in the model..
> how do i repopulate the values in the form .. do i have to set them
> again in the controller??
>
>
>
> Regards
> Abhishek
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" 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?hl=en
-~----------~----~----~----~------~----~------~--~---