Fans,
i try to save multiple entries in the database.
Example:
index.ctp
echo $this->Form->create('Item');
echo $this->Form->input('0.Item.name');
echo $this->Form->input('1.Item.name');
echo $this->Form->end('save');
Item.php
class Item extends AppModel {
var $validate = array(
'name' => 'email'
);
}
ItemsController.php
public function index() {
if($this->request->is('post')){
if($this->Item->saveAll($this->request->data))
$this->Session->setFlash("saved successful");
else{
$this->Session->setFlash("saving error");
debug($this->Item->validationErrors);
}
}
}
When i try to save a non-email value i get the "saving error" but no message for the input fields. The validationErrors are:
array(
(int) 0 => array(
'name' => array(
(int) 0 => 'This field cannot be left blank'
)
),
(int) 1 => array(
'name' => array(
(int) 0 => 'This field cannot be left blank'
)
)
)
Anyone can help me?
Edit:
debugging $this->request->data
array(
(int) 0 => array(
'Item' => array(
'name' => 'test'
)
),
(int) 1 => array(
'Item' => array(
'name' => 'test2'
)
)
)