I have a edit page for my ExpenseClaim model. The edit page lists all the related Expenses belonging to that ExpenseClaim in a form so users can edit the expenses. I have a X next to each expense so they can delete it if needed. This X just removes the rows fields from the DOM using JS.
When the save button is pressed I’d like any removed rows to be deleted from the Expense table but as $this->request->data isnt changing (the changes are only in the DOM) they don’t get deleted. Any edited data does change but not removed data.
I thought about using a postLink but as that creates its own form and I’m already in a form I cant.
So how can I get cake to recognise the changed data? Or am I going about it the wrong way?
Thanks in advance
See this is a database entry and it cannot be deleted like this. And you cannot do it by
unsetalso. The changes has to be reflected in the database.Better you do an
ajaxrequest to the server with theidand delete the row from the database andonSuccesscall back remove theelementfrom thedom.