Fixed Solved - Checkbox list not saving to database on New but is on Edit

PaulT

Member
I am using Joomla 5.1.0, Fabrik Version: 4.1 (GitDate: 2024-05-22)
I have created a Joomla Fabrik form called Staff Documents Attestation that has a checkbox list of documents which are created from a databasejoin Plugin. The element name is afab_staff_documents_attestation___documents. Currently there are 5 titles in that list. If I login as a staff member and select 3 of those titles I want to attest to having read then Save. Fabrik sends an email to me and the managers that list these documents have been attested to, the titles do actually get listed in the email. However after the page reloads all the titles appear unselected. I want the selected ones to remain appearing selected. There seems to be some logging occuring in the database table called afab_staff_documents_attestation_repeat_documents which gets created when I Save on New. However if I go back to the form and select these titles again or different titles and Save they are retained now when I refresh the page which is perfect, I just want that to happen first time around on New. Do you know any way to remedy this?
 
afab_staff_documents_attestation_repeat_documents which gets created when I Save on New
No, it gets created when you create the element, it's for to storing the selected options per record.
Not sure of your setup.
You say you created a form (you should start with creating a list).
However after the page reloads
How do you call this form?
I assume the "reload" will open a new record again (so nothing selected).

Try with the list (it should have been created with your form).
 
Yes I did start with a List.
The Form is loaded into a Joomla page via a Fabrik Form Module. The Page is in the Staff Area were staff have to login first to see it.
The "Staff Documents Attestation Form" Module has these settings in the Advanced Tab:
Form: Staff Documents Attestation
Row id: -1
Use key: name
By having it set like this instead of writing new records if you change your document selections it just modifies the first record of that staff member and it retains the settings on the form view. When the selection is retained it is good because weeks later more documents can be added and when the staff member logs back in they can see which ones they have previously read, then just read the new ones and add them to the selection and Save and it just updates the record and retains that. When they first make a new record it would be great if I could find a way to do an edit in the background so it retained the values.
The documents are uploaded using File upload element to a folder, there is a field where the Staff Admin can write the name of the file before Saving the upload, the field name is "document_title". This is all in a list called "Staff Documents List" afab_documents.
The "Staff Documents Attestation" list has the "Documents Read" element that is the databasejoin to the afab_documents list Value: id Label: document_title. So it pulls the document titles straight from the uploaded files table.
I have tried to build this system in other ways but I just keep running into brickwalls. I would appreciate any help you can give me on this.
 
Try in components\com_fabrik\models\list.php change lines 7830, 7831 to
$rowId = '';
$origRowId = '';

(until php7 0 == '', in php8 it's not longer the case)
 
Back
Top