I would like to add a checkbox field, with multiple checkboxes, with more than one checked by default.
The field would save, and in new content items, it would default to have both checkboxes checked.
Error
Save failed with the following error: The default value is invalid.
PHP Built On Linux hp-i5 4.15.0-55-generic #60-Ubuntu SMP Tue Jul 2 18:22:20 UTC 2019 x86_64
Database Type mysql
Database Version 5.7.27-0ubuntu0.18.04.1
Database Collation utf8_general_ci
Database Connection Collation utf8mb4_general_ci
PHP Version 7.2.20-2+ubuntu18.04.1+deb.sury.org+1
Web Server Apache/2.4.29 (Ubuntu)
WebServer to PHP Interface apache2handler
Joomla! Version Joomla! 3.9.10 Stable [ Amani ] 10-July-2019 15:57 GMT
Joomla! Platform Version Joomla Platform 13.1.0 Stable [ Curiosity ] 24-Apr-2013 00:00 GMT
User Agent Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0
This validation logic is in line 278 of "administrator/components/com_fields/models/field.php".
I did some searching and concluded this was a new issue, sorry if I've missed something and this is already reported or resolved.
Looking in 3.10 dev the issue seems to still be there https://github.com/joomla/joomla-cms/blob/3.10-dev/administrator/components/com_fields/models/field.php
I'm happy to try and code up a fix if people agree this is a valid bug.
I guess this is also the case for fields of the type "list" and "list of images", as they also support multiple values.
Labels |
Added:
J3 Issue
Removed: ? |
Labels |
Added:
?
|
Status | New | ⇒ | Discussion |
I would consider it as a valid bug. Please submit PR.
I believe this is the same as repeatable fields? You would need {value1,value2} or similar as to how it’s stored in the DB.
I agree that comma separated support would be welcomed too!
This issue still exist in Joomla 4b6 and below :( It would be great if you can fix it. I really need this feature. Thanks!
@AndyGaskell did you ever come up with a workaround for J3 initially?
I've just tried doing the same thing today, and will be wanting to do so more with Custom Fields in the future, so if you've not made some progress, I'll raise it with Enhancement Team to look at for a fix for Joomla 4.1.
Labels |
Added:
No Code Attached Yet
good first issue
Removed: ? |
I would like to work on this project, can you please help me to set up the project
If you are new to github - start reading documentation here: https://docs.joomla.org/Working_with_git_and_github.
You can for the project in your own repo. Work on branch 4.1 dev.
Hi @Siddhesh-Yadav
If you are new to Joomla,
You can't understand Joomla in a day or in a week or in a month, it will take time to learn.
So don't give up
Little advice from my side
Is Joomla going to participate in GSOC 2022,sir? so this will be considered as a valid contribution.
I'm working on it . Please guide me.
@brianteeman Can I work on this issue?
Can someone please update the labels to change to J4 Issue and to remove the incorrect Good First Issue
Labels |
Added:
J4 Issue
Removed: J3 Issue good first issue |
How are you getting on @adithyareddych ?
Status | Discussion | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2022-12-04 06:47:11 |
Closed_By | ⇒ | joomdonation |
Apart from the validation, having multiple default values works fine.
So, if I go and set the value in MySQL manually, like...
UPDATE `o5h9d_fields` SET `default_value` = 'apples,pears' WHERE `o5h9d_fields`.`id` = 15;
...then the form UI works as you'd expect, making both boxes checked by default.
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/25785.