Custom component development- Frontend add/edit save error. Form displays, Controller saves data, upon displaying form a second time, row 1 of my db table is updated, despite starting with a blank form. Always row 1. Version 4.2.9.
Setting $loadData = false in Model does not solve problem.
I found this in FormController.save:
$recordId = $this->input->getInt($urlVar);
which returns 1. Then:
$data[$key] = $recordId;
sets the id = 1, which is incorrect... row 1 will always be edited (first insert will work as it is row 1).
Workaround: Because I want only an add, this works:
Override save method, then, $recordId = "0"; // or set value here, get id value from app->input for edits
alternatively:
$data[$key] = $app->input->get('id'); // and check for 0 in my situation
Issue seems to be site only; admin side seems to work, perhaps the way record id are passed from the list view adminForm, or perhaps using a different controller on admin side for save. Unsure.
Discussion appreciated...
-Christo
Labels |
Added:
No Code Attached Yet
|
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2023-08-22 08:55:44 |
Closed_By | ⇒ | Hackwar |
I can not confirm the issue and since we don't know your code, we can't really help you. So I'm closing this for now.
@christomagnifico I think it would be better to ask your question in the forum (forum.joomla.org) or in the Extension development room in Mattermost