Yesno element throw fatal error is acl protected

lcollong

FabriKant d'applications web
I use a yes/no element in a list used to store users's data together with the user plugin to have a register form and bypass the joomla's one.
This yes/no elt contains the "blocked" equivalent to the juser field.
It is acl protected to not appear in the form/detail view but only in the list view with icon replacement.
There is a default value ("0" in the default field and button set to "default to no").
I get error 500 "sometime".

I'have been able to reproduce the problem with a 4 columns test (id, date_time, field and yes/no).
If the yes/no element is set to default public on all acl, everything works.
If you set the yes/no element to "special" on all except list view, the element does not show in the form view but still in the list as expected. If you try to add a new row, you'll get :

Code:
500
Store row failed: INSERT INTO `f_test` ( `date_time`,`nom`,`yesno` ) VALUES ( '2023-05-22 07:07:11','nom3','' ) Incorrect integer value: '' for column 'yesno' at row 1 ; Please inform your web-site owner
Une erreur est survenue pendant l'exécution de la requête.

Il est possible que vous ne puissiez visiter cette page en raison de :

[LIST]
[*]un lien/favori obsolète
[*]une adresse erronée
[*]un moteur de recherche possède un listing périmé pour ce site
[*]vous n'avez pas accès à cette page
[/LIST]
500 Store row failed: INSERT INTO `f_test` ( `date_time`,`nom`,`yesno` ) VALUES ( '2023-05-22 07:07:11','nom3','' ) Incorrect integer value: '' for column 'yesno' at row 1 ; Please inform your web-site owner
/home/bishlws/examulmtest/components/com_fabrik/models/list.php:7928
Aller à la page d'accueil Page d'accueil
Call stack
# Function Location
1 () JROOT/components/com_fabrik/models/list.php:7928
2 FabrikFEModelList->storeRow() JROOT/components/com_fabrik/models/form.php:1992
3 FabrikFEModelForm->submitToDatabase() JROOT/components/com_fabrik/models/form.php:1924
4 FabrikFEModelForm->processToDB() JROOT/components/com_fabrik/models/form.php:1294
5 FabrikFEModelForm->process() JROOT/components/com_fabrik/controllers/form.php:322
6 FabrikControllerForm->process() JROOT/libraries/src/MVC/Controller/BaseController.php:678
7 Joomla\CMS\MVC\Controller\BaseController->execute() JROOT/components/com_fabrik/fabrik.php:200
8 require_once() JROOT/libraries/src/Dispatcher/LegacyComponentDispatcher.php:71
9 Joomla\CMS\Dispatcher\LegacyComponentDispatcher::Joomla\CMS\Dispatcher\{closure}() JROOT/libraries/src/Dispatcher/LegacyComponentDispatcher.php:73
10 Joomla\CMS\Dispatcher\LegacyComponentDispatcher->dispatch() JROOT/libraries/src/Component/ComponentHelper.php:361
11 Joomla\CMS\Component\ComponentHelper::renderComponent() JROOT/libraries/src/Application/SiteApplication.php:208
12 Joomla\CMS\Application\SiteApplication->dispatch() JROOT/libraries/src/Application/SiteApplication.php:249
13 Joomla\CMS\Application\SiteApplication->doExecute() JROOT/libraries/src/Application/CMSApplication.php:293
14 Joomla\CMS\Application\CMSApplication->execute() JROOT/includes/app.php:61
15 require_once() JROOT/index.php:32

The default value is wrong. Should be '0' instead of '' (or null).

Is this something already "under investigation" or should I try to find a fix ?

NB : I did the same test on a J3/F3/Php 7 site without any problems.
 
Last edited:
or should I try to find a fix ?
Yes please.
I assume it's the in the meantime well known php8 ''!=0 :rolleyes:

At a quick glance:
Maybe
field 'default' needs 0 in fields.xml
and/or in yesno.php there are several defaults comparing/setting to ''
 
I spent a couple of hours without success.
As a workaround I prevent the value to be empty in the parent getValue (radiobutton.php) function

Code:
    public function getValue($data, $repeatCounter = 0, $opts = array())
    {
      
        $v = parent::getValue($data, $repeatCounter, $opts);
        // $$$ rob see http://fabrikar.com/forums/showthread.php?t=25965
        if (is_array($v) && count($v) == 1)
        {
            $v = $v[0];
        }
        if ($v === '') $v = '0';  // added to prevent yesno element to fail store row in case ACL does not show it on the form (value empty instead of default).
        return $v;
    }

But it should disturb in some radiobuttons real element default value. So it's not a solution.

I wasn't able to find where the formModel's data is initially built and why it is not using the raw value (correctly set) rather than the rendered one (set to '' instead of JYES/JNO)...

Added : wrong Hack. It modifies radiobutton default value. Not usable.
 
Last edited:
There is a default value ("0" in the default field and button set to "default to no").
Is the error gone if you don't set anything in the default field?

I'm trying to understand what public function getDefaultValue($data = array()) is doing at all with arrays here.
 
Actually no. In my particular setup where this element is not editable in the form view, whatever I set as default value, it shows the image of 'no' (icon). So it seems to never load the default value on form build or on form submit.
My icons are inverted (red cross for 1 and green action-check for 0) as they initialy stand for "user is blocked". So I want red cross if the user is blocked (1).
Whatever I set as default value it shows the green action-check (0).
I've used the button default yes/no (see screenshot) with the same value as the default field. Tested with both to 0 and both to 1.
I've used the button default yes/no with nothing in the default field. Tested with Yes and with No
I've used the button default yes/no with eval swith on and "return TRUE;" or "return FALSE" according to the button default switch.

And each time I save the form I get the error 500 due to insert '' on a int(1) column.

Analysing fabrik's internal structure shows that the non raw value of the element is set to something but the raw value is always empty.

Hope you'll understand better than me where the default value is being screwed up before record is inserted.
 

Attachments

  • Capture.PNG
    Capture.PNG
    16.2 KB · Views: 40
  • Capture.PNG
    Capture.PNG
    12.5 KB · Views: 39
  • Capture.PNG
    Capture.PNG
    5.4 KB · Views: 39
  • Capture.PNG
    Capture.PNG
    30.2 KB · Views: 44
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top