At the moment I'm evaluating Grav. I have Grav v1.1.0-beta.5 and Admin v1.1.0-beta.5 installed and I experienced two issues. First, it is impossible within Admin plugin to uncheck all checkboxes in a group and save it afterwards. To reproduce this issue take for example this
(the process
option in the system configuration), uncheck all checkboxes and hit save. It will show the state you had before (either one checkbox enabled or two).
The second issue I've found is an UX issue. See here
where the texts overflows the box.
I replicated the issue with the checkboxes
Ok the cause of the issue is: if the checkbox is not selected, it's not sent as part of the post data by the form. This is normal, but in the controller's prepareData()
, the defaults of the system config are merged in, so process.markdown is always set to true. @w00fz do you think we can solve this with a solution like http://stackoverflow.com/a/1992745 ? Or this needs to be solved on the php side
I didn't like much that solutions because it forced us to keep 2 very different fields, with the same name, in the DOM. It could have potentially caused troubles for the JS whenever needing to look for that field and looking by the name, in which case you would have gotten an array of fields containing both.
What I did to fix this is to do a quick lookup for checkboxes that aren't checked in the form, whenever the form gets submitted. For each of those fields which would never get submitted because unchecked, I am creating an hidden field with the same name and with a forced value of 0, then I append it to the form and let the form submission continue.
Seems to be working fine for me now.