I have a table called specs. I need to edit multiple rows from it in one form and save it at once.
// table structure
specs [id, name, value, owner_id]
// controller part
$data = $this->Spec->find('all'); // skipping the conditions and other sub-code
$data = set::combine(...);
/*
result, keyed using the spec[id] column.
array (
[3] = array(id=>...),
[22] = array(id=>...)
)
*/
Now I’m not sure how to continue.
I know how to build a form ready to CREATE new multiple records(Model.{n}.fieldname), but how can i create an “edit” form that will allow the saveAll()?
trying to iterate through the result array gets the form close.. but i can’t see the values of fields in the input elements..
You can try this:
In the controller:
In the view:
PS: I think you can adapt my
Productexample to your needs can’t you? : )