The field should attain the default value, ie. Super Users (ID: 8)
Defaults to the previously selected item(s) (Administrator in the case of the gif below)
Discovered while testing #33188 (Issue still persists after changing the layout)
The default value for this field in the XML seems to be fine.
joomla-cms/plugins/user/token/token.xml
Line 31 in c57cd15
If I clear the value in the database table directly then the input field selects Super User (ID: 8) by default on save. But after selecting a different user group, this bug is again reproducible.
If multiple fields were selected before then all of them are retained. (No updation)
Labels |
Added:
?
|
Thinking more about it, I don't see any issue. Clearing the field with selecting it while CTRL key pressed is nothing which a user would want to do, and if that happens, it's ok for me that the field changes back to the previous selection when saving.
It makes sense now. Thanks for the insight @richard67 . I'll close the issue for now and if need be, it can always be re-opened.
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2021-04-19 17:51:21 |
Closed_By | ⇒ | YatharthVyas |
Defaults to the previously selected item
This is how <select multiple>
works, if all items is unchecked then the browser do not send anything to server, and so on server stays old value.
The same behavior for checkboxes, if they unchecked then the browser do not send anything to server.
@YatharthVyas if you like you can make a PR to make this field "required", this should help to avoid such cases
@YatharthVyas That's how form validation works in Joomla (at least in 4), as far as I know. If there is a field which has an invalid value, and I'd assume an empty group ID field is such a case, then the form is not saved, so all previous values are retained.
This makes sense since there might be interdependencies between fields regarding data, so it could lead to an inconsistent result if you just set one field back to the default and save the changes for the others.
Ok, this case here might be a bad example, but I think you get what I mean.
So for me the issue here is not that the changed form data is not saved and the previous form data is retained instead of using the default.
For me the issue is that there is no validation message ("Invalid field Allowed User Groups" error alert) shown, or it is shown only for a short time and then hidden by the "Plugin saved." success alert, that can also be. And at the end the "Plugin saved." success alert is shown, which should not be the case.
But I might be wrong or missing something, so lets see if other opinions drop in.