1
如何編輯多行的表格?
我跟着這裏的教程http://matsimitsu.com/blog/2008/01/06/saveall-with-cakephp.html,但它似乎並沒有工作。CakePHP - 多行編輯
這是我正在做的,但它不工作。
感謝,
三通
function editAll() {
$this->data = $this->Settings->find('all', array('conditions' => $conditions));
}
然後在視圖中,這是我
foreach ($this->data as $setting):
echo $form->input('Setting.' . $setting['Setting']["id"] . '.value', array('value' => $setting['Setting']["value"]));
endforeach;
然後在添加功能我有
function add() {
if (!empty($this->data)) {
$this->Setting->create();
if ($this->Setting->saveAll($this->data)) {
$this->Session->setFlash(__('The Setting has been saved', true));
$this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(__('The Setting could not be saved. Please, try again.', true));
}
}
}