Cakephp: edit view inserting instead of updating
If I have an edit view that is inserting a row instead of updating a row, what do I need to check?
The id of the row I'm editing is being passed in on the url:
http://localhost/cakepf/schedules/edit/78
Here are the contents of $this->data that are being passed into the edit controller functio开发者_开发百科n:
Array
(
[Schedule] => Array
(
[task_id] => 1
[repeat_type_id] => 10
[priority] =>
)
)
task_id and repeat_type_id are required; priority is not.
You need to have a echo $this->Form->input('Schedule.id', array('type' => 'hidden'));
so that CakePHP knows that you are editing.
精彩评论