In a display field, I concatenate several fields and when one of these fields contains ' this causes an error, as if this apostrophe was considered a separator in the SQL query.
The content of the text field does not cause any error, the error occurs only when the display field displays. If I correct the data by replacing the apostrophe with ’, the display is OK. So, in my display code, I tried a str_replace but it doesn't work, the error is always the same.
I also tested the proposed code here https://fabrikar.com/forums/index.p...encoding-when-display-only.52173/#post-272360 and here https://fabrikar.com/forums/index.p...apostrophe-on-fabrik-forms.51239/#post-267676 but without more success.
Is it a bug? Does anyone have any idea a solution?
Solution: use calc field for the element, thank you @troester
Code:
Une erreur est survenue
0 syntax error, unexpected identifier "Arve"
Call stack
# Function Location
1 () JROOT/libraries/fabrik/fabrik/fabrik/Helpers/Php.php(69) : eval()'d code:17
2 Fabrik\Helpers\Php::createFunctionInMemory() JROOT/libraries/fabrik/fabrik/fabrik/Helpers/Php.php:186
3 Fabrik\Helpers\Php::getClassName() JROOT/libraries/fabrik/fabrik/fabrik/Helpers/Php.php:46
4 Fabrik\Helpers\Php::Eval() JROOT/components/com_fabrik/models/element.php:1432
5 PlgFabrik_Element->getDefaultValue() JROOT/plugins/fabrik_element/display/display.php:147
6 PlgFabrik_ElementDisplay->getDefaultOnACL() JROOT/plugins/fabrik_element/display/display.php:162
7 PlgFabrik_ElementDisplay->getValue() JROOT/plugins/fabrik_element/display/display.php:107
8 PlgFabrik_ElementDisplay->renderListData() JROOT/components/com_fabrik/models/list.php:1289
9 FabrikFEModelList->formatData() JROOT/components/com_fabrik/models/list.php:1063
10 FabrikFEModelList->finesseData() JROOT/components/com_fabrik/models/list.php:958
11 FabrikFEModelList->getData() JROOT/components/com_fabrik/models/list.php:735
12 FabrikFEModelList->render() JROOT/components/com_fabrik/views/list/view.base.php:437
13 FabrikViewListBase->display() JROOT/components/com_fabrik/views/list/view.html.php:46
14 FabrikViewList->display() JROOT/administrator/components/com_fabrik/controllers/list.php:156
15 FabrikAdminControllerList->view() JROOT/libraries/src/MVC/Controller/BaseController.php:693
16 Joomla\CMS\MVC\Controller\BaseController->execute() JROOT/administrator/components/com_fabrik/fabrik.php:104
17 require_once() JROOT/libraries/src/Dispatcher/LegacyComponentDispatcher.php:71
18 Joomla\CMS\Dispatcher\LegacyComponentDispatcher::Joomla\CMS\Dispatcher\{closure}() JROOT/libraries/src/Dispatcher/LegacyComponentDispatcher.php:73
19 Joomla\CMS\Dispatcher\LegacyComponentDispatcher->dispatch() JROOT/libraries/src/Component/ComponentHelper.php:361
20 Joomla\CMS\Component\ComponentHelper::renderComponent() JROOT/libraries/src/Application/AdministratorApplication.php:143
21 Joomla\CMS\Application\AdministratorApplication->dispatch() JROOT/libraries/src/Application/AdministratorApplication.php:186
22 Joomla\CMS\Application\AdministratorApplication->doExecute() JROOT/libraries/src/Application/CMSApplication.php:293
23 Joomla\CMS\Application\CMSApplication->execute() JROOT/administrator/includes/app.php:61
24 require_once() JROOT/administrator/index.php:32
Code:
$champs = str_replace(''','’',$champs);
Is it a bug? Does anyone have any idea a solution?
Solution: use calc field for the element, thank you @troester
Last edited: