Hi,
I've been working through the tutorial on updating tabular input (http://www.yiiframew...1/en/form.table) and I've got the front end part working. I don't know how to write the controller though so that it saves each model back to the database.
I inserted my best guess below of:
$task->save();
That gets me an error of:
"Property 'Task.value' is not defined."
Please explain how I would go about this. I'm very new to PHP and Yii so please be thorough.
public function actionUpdateBetaTaskList($id)
{
//gets an array of tasks to update
$tasks = Task::model()->findAll('bdList=:bdList', array(':bdList'=>1));
if(isset($_POST['Task']))
{
foreach($tasks as $i=>$task)
{
if(isset($_POST['Task'][$i]))
$task->attributes=$_POST['Task'][$i];
$task->save();
}
$this->redirect(array('indexProjects'));
}
$this->render('update_tasklist2',array(
'tasks'=>$tasks,
));
}
I've been working through the tutorial on updating tabular input (http://www.yiiframew...1/en/form.table) and I've got the front end part working. I don't know how to write the controller though so that it saves each model back to the database.
I inserted my best guess below of:
$task->save();
That gets me an error of:
"Property 'Task.value' is not defined."
Please explain how I would go about this. I'm very new to PHP and Yii so please be thorough.
public function actionUpdateBetaTaskList($id)
{
//gets an array of tasks to update
$tasks = Task::model()->findAll('bdList=:bdList', array(':bdList'=>1));
if(isset($_POST['Task']))
{
foreach($tasks as $i=>$task)
{
if(isset($_POST['Task'][$i]))
$task->attributes=$_POST['Task'][$i];
$task->save();
}
$this->redirect(array('indexProjects'));
}
$this->render('update_tasklist2',array(
'tasks'=>$tasks,
));
}