Hi,
This is probably simple, but I can't find any specifics on it.
I have a controller called ledger_controller, which uses two models:
Ledgeraccount and Ledgertransaction. Within this controller i have a
function called chartofaccounts, which includes a form, with an action
that leads to the ledger controller, but a function called "add". I
can save the data alright, and also validate it, but I can't get the
error messages to show... why is that?
Controller "ledger":
function add () {
if(!empty($this->data)) {
$this->Ledgeraccount->set($this->data);
if($this->Ledgeraccount->validates()) {
$this->Ledgeraccount->save($this->data, false);
$this->redirect('chartofaccounts');
} else {
$this->Session->setFlash('Venligt ret fejlene
herunder',
'default', array('class'=>'bad'));
$this->redirect('chartofaccounts');
}
}
}
Form in chartofaccounts.ctp
<?=$form->create('Ledgeraccount', array('url' => '/ledger/add'));?>
<?
echo $form->input('Ledgeraccount.number');
echo $form->input('Ledgeraccount.name');
echo $form->input('Ledgeraccount.type', array('options' => array(
'header'=>'Header',
'sum'=>'Sum',
'profitloss'=>'Profit Loss',
'balancesheet'=>'Balancesheet'
)));
?>
<?=$form->end('Create');?>
If this is standard behaviour, then is there any way I can get the
errormessages to show in the chartofaccounts view, without breaking
the conventions too much?
Thanks
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---