Hi all,
I just started using Cake and really like it. Unfortunately I have an
issue I couldn't solve with Google & co.:
In my model controller there is an action admin_add which basically
redirects the user to an edit view or saves the added page and
redirects to an overview. It looks like this:
function admin_add() {
if (!empty($this->data)) {
if ($this->SimplePage->save($this->data)) {
$this->Session->setFlash("Your page has been saved.");
$this->redirect(array("action" => "index"));
}
} else {
$this->set("authors", $this->SimplePage->Author-
>find("list", array("fields" => array("displayname"))));
$this->render("admin_edit");
}
}
Everything is fine with that except when there is a validation error
in this model (e.g. leaving a field blank which has an notEmpty rule).
Then the following message appears:
"Error: The view for SimplePagesController::admin_add() was not found.
Error: Confirm you have created the file: /var/www/mgvmedia/app/views/
simple_pages/admin_add.ctp"
Okay, creating the add view would be a simple solution. But it would
be a duplicate of the edit view and I would like to keep the use of
the redirect. Can somebody help and tell me how to this? Thanks a
lot...
Check out the new CakePHP Questions site http://cakeqs.org and help others with
their CakePHP related questions.
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