No Code Attached Yet
avatar christomagnifico
christomagnifico
6 May 2023

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

avatar christomagnifico christomagnifico - open - 6 May 2023
avatar joomla-cms-bot joomla-cms-bot - change - 6 May 2023
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 6 May 2023
avatar drmenzelit
drmenzelit - comment - 26 May 2023

@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

avatar Hackwar Hackwar - change - 22 Aug 2023
Status New Closed
Closed_Date 0000-00-00 00:00:00 2023-08-22 08:55:44
Closed_By Hackwar
avatar Hackwar Hackwar - close - 22 Aug 2023
avatar Hackwar
Hackwar - comment - 22 Aug 2023

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.

Add a Comment

Login with GitHub to post a comment