Hello Cake-Fans,
i try to save more than 1 entry 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'
)
)
)
Is that the correct way to save many entrys? Whats my failure?
Many Thanks for your help
Steffen
--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.