Joomla 3.9.13

PHP version: 7.3.9

Mysql Ver 15.1 Distrib 10.4.6-MariaDB

I am using the default Joomla contacts component, with no changes or overrides. I have configured a number of custom fields my contacts. One of these custom fields is type sql. It selects values from a custom database table and offers these to the user when they fill in a form, the sql form field configuration is below;

enter image description here

When I select one the values and save, some of the form inputs clear, but multiple values are sent to the database.

I created a short video with captions here.

I've also made a short video of the same issue but with different fields.

In the video you will see the output of var_dump($form->getData()), I added this line to plugins/system/fields/fields.php as recommended by @RobbieJackson. You can see the data disappear as I save the page, yet it remains in the database.

Another suggestion was to output the SQL query which is run to get the data. In administrator/components/com_fields/models/field.php I added echo $this->getDbo()->replacePrefix((string) $query) . "<br>"; in the method getFieldValues. The output is below;

enter image description here

When I copy and paste the first query into HeidiSql I can see the data, but it's not rendering on the form. The parish field data is in field_id 17.

In the file administrator/components/com_fields/helpers/fields.php, in the prepareForm() function there's a line $value = $model->getFieldValue($field->id, $data->id); (around line 506), below this I've added echo '<pre>' . var_export($value, true) . '</pre>';, the output is below;

enter image description here

As you can see the parish field is NULL in the form, but in the database there are five values.

In the video I switch between my site and HeidiSQL in order to query the contact i'm editing. You can see that the data is in the database, but won't display in the form until I delete some other fields.

I've reinstalled the Joomla core files and ran extensions > manage > fix. Still the same issue.

I have tried this same procedure on a clean install of Joomla 3.9.13 and there are no issues, works as expected. This is strange as both sites are on the same localhost environment, same version of Joomla, and I haven't made any changes to any core files.

I had the following third party components installed but I have since removed them.

  • easyblog
  • sp page builder
  • dropfiles
  • admin tools
  • akeeba backup
  • Regular Labs - Cache Cleaner

Any idea why this would be happening or how I can troubleshoot?

  • Can you replicate this issue in a clean new Joomla install, because I was not able to do that. – Zollie Dec 10 '19 at 13:04
  • I think it not only can help you but can help anybody who would try to understand your issue, because if it cannot be replicated on a clean Joomla install it means that the site you are facing this issue on has something special settings, or plugin or other component or any other extension which can cause a conflict somewhere and the problem is not in core Joomla. This is at least a step further to find the real cause of this issue according to me. I have no other clue yet... – Zollie Dec 10 '19 at 15:40
  • Is there any third party plugin or component which touches the Contacts component or triggered by that in any way? Is there any third party plugin that can influence savings to the database or any way the model of contacts or any third party caching plugin which can influence the behavior - on this problematic site? – Zollie Dec 10 '19 at 17:17
  • I've been trying, but can't replicate the problem, so here are some suggestions as to where the problem might lie and how to could try to troubleshoot it. 1. Check the Joomla database isn't corrupt – in particular that the data looks right in the fields table; compare with your joomla instance that works ok. 2. Unpublish all of your 3rd party extensions. If that solves the problem then publish them again one by one to see which one is causing the problem. (You do get plugins which obfuscate email addresses in web sites, but obviously shouldn't be doing what you're seeing.) – Robbie Jackson Dec 11 '19 at 16:30
  • 1
    @jonboy Check in the browser inspector after you open a contact page in admin when its not showing the values, check it. In the inspector it self. Its all about HTML. To determinate if it is interface related or code. – Artur Stępień Dec 16 '19 at 19:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.