fabrik icon indicating copy to clipboard operation
fabrik copied to clipboard

Hidden field element type integer does not store default value

Open EricdeWaal opened this issue 2 years ago • 4 comments

I have an element Field 'lidnummer' set to;

Options Default: 0 Advanced Input type: number Formatting: Integer, 11 / 0

Depending on the input of a previous field,'lidnummer' is hidden or shown, If it is shown, 0 is displayed and it works.

If it is hidden, on submission an error is shown: Incorrect integer value: '' for column prachta_dtc.a_preregistered.lidnummer at row 1

This does not happen in J3/F3. There, if the field is hidden, 0 is written into the database. In the database, the colum 'lidnummer' is set by Fbrik to the type int(11).

EricdeWaal avatar Nov 19 '22 16:11 EricdeWaal

This does not happen in J3/F3. With php7 or php8?

trob avatar Nov 19 '22 16:11 trob

On the production J3/F3 site I run PHP 7.4.33 Even if the default value there is not set to 0, the element writes 0 in the database when hidden (and thus empty).

I 'solved' this for now by setting no default value, and in the form I use a PHP plugin that on BeforeProcess sets the 'lidnummer' field to zero, when it's empty.

But it is definitely a different behaviour from F3.

EricdeWaal avatar Nov 20 '22 15:11 EricdeWaal

Is this still an issue with the latest version?

trob avatar Dec 22 '22 10:12 trob

Yes, the issue is still present in version 4.0beta4b

EricdeWaal avatar Jan 03 '23 14:01 EricdeWaal