User tests: Successful: Unsuccessful:
The PR adds a hidden input to allow to submit an empty value when nothing is selected in list (multiple) and checkbox(-es) fields. Because browser does not submit anything when <select multiple>
is empty, and <input type="checkbox">
is unchecked.
For now Developers had to use extra check in their Table or Model, however suggested fix should simplify such things.
Install testing component com_testi-1.0.1.zip
Create a new Item with some values in checkboxes and list.
Then try uncheck all and remove all selected values, and save again.
After save the previous valueas are shown as checked/selected.
After save everything stays unchecked/unselected.
Please select:
Status | New | ⇒ | Pending |
Category | ⇒ | Layout |
I have tested this item ✅ successfully on dd5e4ac
I tested this PR successfully. I experienced this issue in some of my own custom components, and I'm glad that there's now a solution for that.
Thanks for solving this @Fedik !
Status | Pending | ⇒ | Ready to Commit |
Labels |
Added:
Feature
RFC
PR-5.2-dev
|
RTC
Labels |
Added:
RTC
|
I have tested this item ✅ successfully on a434358
I tested this and it worked.
This pull request has been automatically rebased to 5.3-dev.
Title |
|
I like the idea, but I fear that this will break existing extensions as it comes all of the sudden with an empty string. Stuff like if(empty($data['com_fields]['radio']))
will not be true anymore as it contains an array with an empty element. It needs an additional array_filter call then.
I would say so till we get confirmation that I'm wrong.
Status | Ready to Commit | ⇒ | Pending |
Back to pending. See previous comments.
Labels |
Added:
PR-5.3-dev
Removed: RTC PR-5.2-dev |
Is the Postgresql test error related, Screenshot
There some issue with test, I think. But not related to changes in this PR.
From screenshot it is clear that the categories are there, but the Test does not see them
The checker should probably wait when page fully rendered before doing DOM query.
But it just my guess.
UPD, on screenshoot the categories in diferent order than expected by test.
I had a look and the returned data when no value is selected (I tested it with list). Then it is an empty string and not an empty array. As an array is expected, it is very likely that it gets casted to an array and then you end up with an array which has one entry, the empty string.
I'm aware that this is an edge case, but a list field is widely used nowadays and I fear this will break stuff.
I see. Thanks for checking.
To me it is a bug in data handling by the "list" custom field. The data should be filtered instead of blind cast to array.
I will look, maybe will make it optional, or will change to 6.0.
We already use the same approach for subform (multiple) field for years, and it works fine.
It is realy a pain to handle this input behaviors.
And because we have it since ages, it is really hard to change the behavior without breaking stuff into the wild.
Category | Layout | ⇒ | Layout Libraries |
I have update the code. Now it is configurable, and disabled by default.
Testing component also updated.
Based on what for a criteria should the end user enable or disable the flag?
When developer want to submit and save empty value. Because browser does not submit any value for these cases.
Check the component I made for testing, try edit administrator/forms/item.xml
and remove these flag.
I think you never use these fields before, in your projects, did you? :)
By default these fields just unusable without extra work. This PR is fixing it.
Ah sorry, I was on custom fields, but you added the option only to the form elements.
I have tested this item ✅ successfully on dd5e4ac
Works as described!
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/43905.