?
avatar Flowman
Flowman
11 Feb 2020

Steps to reproduce the issue

Create a status field, enable filtering and remove unpublished from list.

		<field
			name="published"
			type="status"
			label="JOPTION_SELECT_PUBLISHED"
			filter="1,2,-2,*"
			description="JOPTION_SELECT_PUBLISHED_DESC"
			onchange="this.form.submit();"
			>
			<option value="">JOPTION_SELECT_PUBLISHED</option>
		</field>

Expected result

Unpublished should be removed.

Actual result

Unpublished is still present.

System information (as much as possible)

Joomla 3.9.15
PHP 7.3.2

Additional comments

Issue is in JFormFieldPredefinedList where the in_array will always return true on 0.

avatar Flowman Flowman - open - 11 Feb 2020
avatar joomla-cms-bot joomla-cms-bot - change - 11 Feb 2020
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 11 Feb 2020
avatar brianteeman
brianteeman - comment - 11 Feb 2020

Where are you using this?

avatar Flowman
Flowman - comment - 11 Feb 2020

In my own component. But I like to use Joomla native code.

It' a list of affiliates but they should only be able to be published, archived, trashed.

Either way there is a filter function on the status field or JFormFieldPredefinedList that is not working with 0.

avatar brianteeman
brianteeman - comment - 11 Feb 2020

It must be an issue in your code because clearly we use that everywhere in Joomla

avatar SharkyKZ SharkyKZ - change - 11 Feb 2020
Status New Confirmed
avatar SharkyKZ
SharkyKZ - comment - 11 Feb 2020

I can confirm this issue.

avatar brianteeman
brianteeman - comment - 11 Feb 2020

so how does it work in core?

avatar richard67
richard67 - comment - 11 Feb 2020

As far as I know (but I might be wrong, so correct me if so), the "filter" is applied at form validation, i.e. it has no impact on which options are shown but only on which options are being accepted on validation.

avatar SharkyKZ
SharkyKZ - comment - 11 Feb 2020

@brianteeman We don't use this field with the values required to run into the issue. But it's totally valid issue. The closest we have in core is this:

If you remove 0 from the list and view the dropdown, Unpublished option will still be listed.

@richard67 Right, we have conflicting attributes here. That's another issue. Needs to be solved before 4.0.

avatar alikon
alikon - comment - 24 Feb 2020

please test #28063

avatar alikon alikon - change - 24 Feb 2020
Status Confirmed Closed
Closed_Date 0000-00-00 00:00:00 2020-02-24 20:15:23
Closed_By alikon
avatar alikon alikon - close - 24 Feb 2020

Add a Comment

Login with GitHub to post a comment