• Hello Fabrik Community

    Fabrik is now in the hands of the development team that brought you Fabrik for Joomla 4. We have recently transitioned the Fabrik site over to a new server and are busy trying to clean it up. We have upgraded the site to Joomla 4 and are running the latest version of Fabrik 4. We have also upgraded the Xenforo forum software to the latest version. Many of the widgets you might have been used to on the forum are no longer operational, many abandoned by the developers. We hope to bring back some of the important ones as we have time.

    Exciting times to be sure.

    The Fabrik 4.0 Official release is now available. In addition, the Fabrik codebase is now available in a public repository. See the notices about these in the announcements section

    We wish to shout out a very big Thank You to all of you who have made donations. They have really helped. But we can always use more...wink..wink..

    Also a big Thank You to those of you who have been assisting others in the forum. This takes a very big burden off of us as we work on bugs, the website and the future of Fabrik.

Dropdown element of a joined list is not saving

bascherz

Member
I have a list that is a join of two tables and only one element in the associated form is writeable. The correct people have access, can select from the drop list and can click the save button, but the selected value is not being saved. No error message is output. What would cause this?

Thanks in advance,
Bruce
 
Form settings -> Form processing, is "Record in database" set to "Yes"?
Element settings - > Access, is "Save to database" set to "Yes"?
No javascript error in browser console?

If it's a databasejoin element, does it make a difference when you change the value element in databsejoin Data tab.

I have experienced also a case when the element just gets "broken". So creating a new element and updating with the old element values in PhpMyAdmin has solved the case.
 
Last edited:
Hi troester,

The tables joined are #__users and #__comprofiler and, indeed, they are joined on the "id" field. There is a third table (a second join) that is used for filtering, but it's still a join, and it is also joined on the primary key for that third table. Is it possible that is interfering? As these are Joomla and Community Builder user profile tables, there is really just the one profile field that needs to be editable in this list. Yes, the field of interest is available via the CB profile editor, but there is a community of site members who need to be able to change it as part of a workaround for a currently crippled/disabled site workflow task. The field is not accessible to the profile owner (it's a control field).

Many thanks for responding. I sure hope I can get this to work. Needed Monday morning!

Cheers,
Bruce

One other thing... the access level for all the other fields in this list is "Hidden", an access level similar to Guest but used nowhere on the site other than to hide and write-protect things.
 
Hey juuser,

All those boxes are checked. I've got it setup correctly as far as I can tell. It is NOT a databasejoin element, nor are there any databasejoin elements in the list. The joins (turns out there are THREE) are done in the list "Joins" section.

district-volunteers-list-joins.png


Also, no Javascript error on the front end, only this error:

Code:
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'WHERE' at line 1

also, following this I also get this message:

Code:
Record added/updated

I've written no SQL myself for this particular list, however the element I need to be editable/savable is implemented as a droplist. It's a CB field that in CB is a single-select radio button field and which I tried to make an integer in Fabrik. However, Fabrik insists on saving droplist elements as TEXT. That's neither here nor there for my purpose, so I allowed it. I don't think that aspect has anything to do with this issue, but it might.

Finally looking at the list menu item itself, and there's this option labeled "Overwrite List Data" that defaults to "No". I assume since its tooltip says it applies to importing data that's ALL it applies to. I tried changing it to "Yes" and that had zero affect. And speaking of the menu item, there's also this filter there. This filter does work, and there is another menu item with this same list that is not filtered (available to a higher ACL). So I am pretty sure THIS isn't causing the problem.

district-volunteers-list-filter.png
 
Last edited:
In a (Fabrik) join one column must be a primary key, one column a foreign key.

1st join: You are joining from #_user.id to #_comprofiler.id which is also a primary key.
I think you have to join to #_comprofiler.user_id

3rd join: from cb_zip to zip looks like none is a primary key
 
Actually, zip in the #__zipcodes table is the primary key there. I changed the comprofiler join column to user_id. That made no difference. Still getting the error and still cannot save the record.
 
Enable Fabrik debug and Joomla's system debug.
Maybe you'll get a better error message.
 
It's a live site and typically has well over 500 users actively using it. I can't enable Joomla debug. Never tried Fabrik debug, though. Had to enable it. Then I quickly discovered it doesn't work with SEF URLs (unless /fabrikdebug/1 works or something). So I kicked-up the message level to Development and I get the following message for what appears to be every single row in the list I loaded (about 14,000 rows).

Code:
Deprecated: array_key_exists(): Using array_key_exists() on objects is deprecated. Use isset() or property_exists() instead in /home/ua820988/public_html/lasagnaloveportal.org/components/com_fabrik/models/element.php on line 997

Tried saving the record via the form and got the same blast of the above (weird since I am in the form at this point) and the same nondescript MySQL error message.
 
This is only a warning/notice. I assume you are running php7.4 and Fabrik is not php7.4 ready. This may create issus but I don't think this is the reason here.
Dropdown element of a joined list is not saving ... I have a list that is a join of two tables and only one element in the associated form is writeable. The correct people have access, can select from the drop list and can click the save button, but the selected value is not being saved.
Is this really a dropdown element or a database join? Which exact settings?
If you set other elements of the joined list to be writable, are they saved? Check directly in your database if it's not saved at all or if it's saving to an other/new record in your joined table.
"Only one element writable": The element holding the primary key of the joined table must be enabled

It's a live site and typically has well over 500 users actively using it. I can't enable Joomla debug.
If you can't test on your site (even outside working hours) you should consider to create a development copy (make sure to open and resave the Fabrik connection after copying a site). But I don't see why you can't enable Joomla debug for a short time if you can enable error display, both is showing some infos to users.
 
BTW, even on a production site you can enable JDebug only for some users groups. So regular users won't see joomla debug output . See system plugin debug for parameters

upload_2021-1-17_11-38-12.png
 
Heh, I didn't even know that Debug Plugin was there. I've always just enabled it in Global Configuration. That said, even with everything enabled (the default) none of that information has ever been helpful in tracking down an issue for me. But thanks for pointing this out. I configured it the way it will maybe someday help me but won't interfere with anyone else's experience.

Still having that issue, though I abandoned that particular list and found another way to get the feature I needed that doesn't involve Fabrik. But I have another list that is doing the same thing and it's a much simpler example. I will try to post screen shots here in my "down time". This site keeps me extremely busy!
 
Well, I finally figured out what was wrong with this. Turns out you have to set "Save to database" to "YES" for the primary key element of a list in order to save the writeable elements in that list/table presented in the form. That is so non-intuitive since the primary key is not a column in the database table I want to be in the UPDATE part of the query. Rather, it's the column that should appear in the WHERE clause in Fabrik's UPDATE query. Very strange that that turned out to be the issue this whole time. And now it makes sense that it's happening to multiple lists on my site. I just have to remember to keep those elements either hidden or read-only.

I get the strangest feeling y'all knew this was the issue and were just waiting for me to discover it on my own. ;)
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top