[BUG]: DynamicGet Filter is not saving "Allow Empty" #1244

Open
opened 2025-08-27 14:21:04 +00:00 by Tom van der Laan · 12 comments

What Happened?

i just noticed when working on a site when i try to create a filter on a dynamic get it is not saving the "allow Empty" when it's checked it reverts back to 0.

Steps to reproduce the Bug

create a dynamic get with a filter. try to check allow empty. save.

allow empty should be selected after saving. it is unchecked after save.

I tested this on two different installs.

Which Joomla version are you compiling in?

5.3.3

Which PHP version are you compiling in?

8.3

Which Joomla versions are you targeting?

5

Which PHP version are you targeting?

8.2

Which Web server is JCB running on?

Litespeed

Which Relational Database is JCB running on?

MariaDB 10.11

Which OS is JCB running on?

AlmaLinux 9

Which JCB version are you using?

5.1.1 stable

Where in JCB did this issue occur?

Dynamic Get(admin_view)

On which browsers did you encounter the issue?

Firefox, Safari

Additional Comments

No response

### What Happened? i just noticed when working on a site when i try to create a filter on a dynamic get it is not saving the "allow Empty" when it's checked it reverts back to 0. ### Steps to reproduce the Bug create a dynamic get with a filter. try to check allow empty. save. allow empty should be selected after saving. it is unchecked after save. I tested this on two different installs. ### Which Joomla version are you compiling in? 5.3.3 ### Which PHP version are you compiling in? 8.3 ### Which Joomla versions are you targeting? 5 ### Which PHP version are you targeting? 8.2 ### Which Web server is JCB running on? Litespeed ### Which Relational Database is JCB running on? MariaDB 10.11 ### Which OS is JCB running on? AlmaLinux 9 ### Which JCB version are you using? 5.1.1 stable ### Where in JCB did this issue occur? Dynamic Get(admin_view) ### On which browsers did you encounter the issue? Firefox, Safari ### Additional Comments _No response_
Tom van der Laan added the
Bug
label 2025-08-27 14:21:04 +00:00
Author
Member

this one is also still present in 5.1.2-alpha1

this one is also still present in 5.1.2-alpha1
Author
Member

Image before save: Scherm­afbeelding 2025-08-29 om 02.47.33.png

Image after save: Scherm­afbeelding 2025-08-29 om 02.47.42.png

Image of db after save: Scherm­afbeelding 2025-08-29 om 02.47.52.png

Image before save: ![Scherm­afbeelding 2025-08-29 om 02.47.33.png](/attachments/cdfc75f3-56d3-4f46-8254-adba209a3e74) Image after save: ![Scherm­afbeelding 2025-08-29 om 02.47.42.png](/attachments/27c95593-b53f-400d-9b3e-4493947bc9af) Image of db after save: ![Scherm­afbeelding 2025-08-29 om 02.47.52.png](/attachments/e999a4d1-81a9-4211-b8d4-f8a2fa137607)
Owner

This seems like a messy Joomla thing... since that field is configured to be one if checked see here:

<!-- Empty Field. Type: Checkbox. (joomla) -->
<field
type="checkbox"
name="empty"
label="COM_COMPONENTBUILDER_DYNAMIC_GET_EMPTY_LABEL"
value="1"
default="0"
description="COM_COMPONENTBUILDER_DYNAMIC_GET_EMPTY_DESCRIPTION"
class="inputbox"
/>

This seems like a messy Joomla thing... since that field is configured to be one if checked see here: https://git.vdm.dev/joomla/Component-Builder/src/commit/45453f733054d606e78d7d2ec2c3f515fe359694/admin/forms/dynamic_get.xml#L900-L909
Owner

I literally saves via the Registry class conversion of the subform field, which is all Joomla.

I literally saves via the Registry class conversion of the subform field, which is all Joomla.
Owner

Here is the save method of that filter subform:

// Set the filter items to data.
if (isset($data['filter']) && is_array($data['filter']))
{
$filter = new Registry;
$filter->loadArray($data['filter']);
$data['filter'] = (string) $filter;
}
elseif (!isset($data['filter']))
{
// Set the empty filter to data
$data['filter'] = '';
}

Here is the save method of that filter subform: https://git.vdm.dev/joomla/Component-Builder/src/commit/45453f733054d606e78d7d2ec2c3f515fe359694/admin/src/Model/Dynamic_getModel.php#L1228-L1239
Author
Member

hmm but are you able to replicate it? or something wrong with my installation?

hmm but are you able to replicate it? or something wrong with my installation?
Owner

Nothing in this explains why a 1 becomes a 0

To make matters worse it use to work... I mean I have it working in a number of projects.

Nothing in this explains why a `1` becomes a `0` To make matters worse it use to work... I mean I have it working in a number of projects.
Owner

I see it is breaking on my side as well, the projects where it worked is on older Joomla 5 versions with older PHP. Not that I am sure that is why it broke, but yes I see that it is broken.

I see it is breaking on my side as well, the projects where it worked is on older Joomla 5 versions with older PHP. Not that I am sure that is why it broke, but yes I see that it is broken.
Author
Member

yeah i used to use it in other projects too. I checked the post data that is being sent and it is alreadyy at 0 there.

I tested safari and firefox.

yeah i used to use it in other projects too. I checked the post data that is being sent and it is alreadyy at 0 there. I tested safari and firefox.
Author
Member

i checked php 8.4 and 8.3 (building 8.1 atm on my server so i can test that one)

i checked php 8.4 and 8.3 (building 8.1 atm on my server so i can test that one)
Owner

Found the fix... just remove the default value in the xml, I will add this to the release stack. Seems like a fix upstream, broke this, I just love it when these things happen 👍

Found the fix... just remove the default value in the xml, I will add this to the release stack. Seems like a fix upstream, broke this, I just love it when these things happen 👍
Author
Member

ohh so nice to not have to edit it manually in the db every time i edit it haha :D thanks!

ohh so nice to not have to edit it manually in the db every time i edit it haha :D thanks!
Sign in to join this conversation.
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: joomla/Component-Builder#1244
No description provided.