RTC bug Maintainers Checked Small PR-5.2-dev Failure

User tests: Successful: Unsuccessful:

avatar korenevskiy
korenevskiy
2 Mar 2022

This amendment concerns to use this field to pass ID as an argument. If we use this field not in an XML file but in a dynamic table of fields. In each row of the table, we use the Checkbox to select a row number or select an ID in the list. After activating these checkboxes, we mark which of the parameter lists with which ID we have activated.
I believe that the original code implied the use of checkboxes as just a parameter in the static configuration of the settings page, not to select an ID, but simply to select certain settings.
Therefore, such a subtlety as using the value '0' as a value was not taken into account.
My change does not violate compatibility and does not violate the default settings.
And of course it would be stupid on the part of external developers to use the value '0' of the attribute to get an activated checkbox.
Because the value '0' is interpreted as an empty value and we get an active checkbox. In this way, it is stupid to mark activity using unreadable, this is a stupid approach to activate the checkbox.
Therefore, I suggest using the value '0' as the value for ID selection.

$field = JFormHelper::loadFieldType('сheckbox', true);
$field->setup(simplexml_load_string('<field type="check" default="0"  name="id" />', 0);
echo $field->getInput();

The result can only be seen in the generated HTML. Because of this limitation of fields, we can't check in any other way, except to look for values in HTML.
Before:

<div class="form-check form-check-inline">
	<input
		type="checkbox"
		name="check"
		id="id"
		value="1"
	>
</div>

After:

<div class="form-check form-check-inline">
	<input
		type="checkbox"
		name="check"
		id="id"
		value="0" 
	>
</div>

Here you need to search for the string value ="0" with tests, otherwise no way.
In the Checkbox field, any default value is rendering correctly except for 0.
The default value of 0 is rendering as 1.
This fix can be checked in any module add writing this XML example to the module’s XML configuration file and after check this value in the F12 panel in the browser .

<field 
	name="id"
	type="checkbox"  
	label="Test value 0 in Checkbox!!!"  
	default="0" />
avatar korenevskiy korenevskiy - open - 2 Mar 2022
avatar korenevskiy korenevskiy - change - 2 Mar 2022
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 2 Mar 2022
Category Libraries
avatar korenevskiy korenevskiy - change - 2 Mar 2022
Labels Added: ?
avatar laoneo
laoneo - comment - 19 Mar 2022

Thanks for your pull request. Please add a proper test instruction, so we can test it.

avatar korenevskiy
korenevskiy - comment - 22 Mar 2022

Thanks for your pull request. Please add a proper test instruction, so we can test it.

I can't find the Checkbox field test file. I'm new to writing tests. Previously, I wrote only 2 amendments to Joomla tests. Please tell me where I can find the Checkbox field test.

avatar Quy
Quy - comment - 22 Mar 2022

Please provide steps to reproduce the issue in order to test the PR.

avatar korenevskiy
korenevskiy - comment - 22 Mar 2022
$field = JFormHelper::loadFieldType('сheckbox', true);
$field->setup(simplexml_load_string('<field type="check" default="0"  name="id" />', 0);
echo $field->getInput();

The result can only be seen in the generated HTML. Because of this limitation of fields, we can't check in any other way, except to look for values in HTML.
Before:

<div class="form-check form-check-inline">
	<input
		type="checkbox"
		name="check"
		id="id"
		value="1"
	>
</div>

After:

<div class="form-check form-check-inline">
	<input
		type="checkbox"
		name="check"
		id="id"
		value="0" 
	>
</div>

Here you need to search for the string value ="0" with tests, otherwise no way.
In the Checkbox field, any default value is rendering correctly except for 0.
The default value of 0 is rendering as 1.

avatar laoneo
laoneo - comment - 23 Mar 2022

When you have a look at #37349, there you can see some test instructions how it should be. If the tester has to edit some files, write that in the testing instructions. That's not a problem.

avatar korenevskiy korenevskiy - change - 15 May 2022
The description was changed
avatar korenevskiy korenevskiy - edited - 15 May 2022
avatar korenevskiy
korenevskiy - comment - 15 May 2022

When you have a look at #37349, there you can see some test instructions how it should be. If the tester has to edit some files, write that in the testing instructions. That's not a problem.

You are right, I understood my mistake. I described a new correction indicating the perimers on the principle: as it was before, and how it will become in the future.
I added a description of the PR header .

avatar korenevskiy korenevskiy - change - 15 May 2022
The description was changed
avatar korenevskiy korenevskiy - edited - 15 May 2022
avatar korenevskiy korenevskiy - change - 15 May 2022
The description was changed
avatar korenevskiy korenevskiy - edited - 15 May 2022
avatar HLeithner
HLeithner - comment - 27 Jun 2022

This pull request has automatically rebased to 4.2-dev.

avatar joomla-bot
joomla-bot - comment - 27 Jun 2022

This pull requests has been automatically converted to the PSR-12 coding standard.

avatar korenevskiy korenevskiy - change - 1 Jul 2022
Labels Added: ?
avatar korenevskiy korenevskiy - change - 27 Aug 2022
Labels Added: ?
Removed: ?
avatar korenevskiy korenevskiy - change - 24 Oct 2022
Labels Added: ? Maintainers Checked
Removed: ?
avatar HLeithner
HLeithner - comment - 2 May 2023

This pull request has been automatically rebased to 4.3-dev.

avatar korenevskiy
korenevskiy - comment - 13 Jul 2023

@HLeithner Is it possible to transfer this PR to Joomla 5 ?

avatar Fedik
Fedik - comment - 13 Jul 2023

This is a bug, and can go to 4.x, just need to be tested

avatar korenevskiy korenevskiy - change - 13 Jul 2023
Labels Added: bug PR-4.3-dev ?
Removed: ? ?
avatar Fedik Fedik - test_item - 13 Jul 2023 - Tested successfully
avatar Fedik
Fedik - comment - 13 Jul 2023

I have tested this item successfully on 6fd6fcb


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/37174.

avatar Fedik Fedik - test_item - 13 Jul 2023 - Tested successfully
avatar Fedik
Fedik - comment - 13 Jul 2023

I have tested this item successfully on 8b05ef3


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/37174.

avatar korenevskiy
korenevskiy - comment - 14 Jul 2023

@Fedik How do you think if we set the Default field to FALSE, how should it work? And probably we think about in which cases it may turn out that we will need to specify the value FALSE.

<field type="check" default="false"  name="id" />
avatar Fedik
Fedik - comment - 14 Jul 2023

HTML supports only string value, so no boolean values.
You cannot do <input type="checkbox" value="false"> and expect it will be a boolean, it will be a string false. The same for Joomla XML fields.
so only 1 or 0

avatar korenevskiy
korenevskiy - comment - 14 Jul 2023

so only 1 or 0

You are right, this will be enough for all use cases.

avatar korenevskiy
korenevskiy - comment - 10 Aug 2023

@bembelimen Please confirm this PR

avatar HLeithner
HLeithner - comment - 30 Sep 2023

This pull request has been automatically rebased to 4.4-dev.

avatar korenevskiy
korenevskiy - comment - 27 Dec 2023

@HLeithner
And when will this PR be merged to v5?

avatar HLeithner HLeithner - change - 24 Apr 2024
Title
Add support ID with 0 for value CheckboxField.php
[4.4] Add support ID with 0 for value CheckboxField.php
avatar HLeithner HLeithner - edited - 24 Apr 2024
avatar HLeithner
HLeithner - comment - 15 Nov 2024

This pull request has been automatically rebased to 5.2-dev.

avatar HLeithner HLeithner - change - 15 Nov 2024
Title
[4.4] Add support ID with 0 for value CheckboxField.php
[5.2] Add support ID with 0 for value CheckboxField.php
avatar HLeithner HLeithner - edited - 15 Nov 2024
avatar korenevskiy
korenevskiy - comment - 6 Dec 2024

Wow.. 2.5 years have passed.

avatar rdeutz rdeutz - change - 16 Jan 2025
Labels Added: PBF Small PR-4.4-dev PR-5.2-dev
Removed: PR-4.3-dev ?
avatar joomdonation joomdonation - test_item - 19 Jan 2025 - Tested successfully
avatar joomdonation
joomdonation - comment - 19 Jan 2025

I have tested this item ✅ successfully on 76a3db2


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/37174.

avatar joomdonation joomdonation - alter_testresult - 19 Jan 2025 - Fedik: Tested successfully
avatar joomdonation joomdonation - change - 19 Jan 2025
Status Pending Ready to Commit
avatar joomdonation
joomdonation - comment - 19 Jan 2025

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/37174.

avatar rdeutz rdeutz - change - 19 Jan 2025
Labels Added: RTC
Removed: PBF PR-4.4-dev
avatar Hackwar Hackwar - change - 19 Jan 2025
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2025-01-19 14:07:06
Closed_By Hackwar
avatar Hackwar Hackwar - close - 19 Jan 2025
avatar Hackwar Hackwar - merge - 19 Jan 2025
avatar Hackwar
Hackwar - comment - 19 Jan 2025

Thank you!

Add a Comment

Login with GitHub to post a comment