There is an unsaved comment in progress. You will lose your changes if you continue. Are you sure you want to reopen the work item?
Orchard.Forms Checkbox only works correctly when Checked defaults to false
I ran across an issue when trying to use a checkbox in a projection layout form. If I set the Checked option to true, the checkbox always displays as checked on the form even though the behavior from it being unchecked worked as expected. What I found
is that when the checkbox value is being serialized to the database, if it's unchecked, no value is stored in the XML. Upon loading, since the value is null, the default value in the form definition is used, so it displays checked.
The expected behavior works because the value that comes back in the State is null which is not equal to the checked value "on". Of course, when it is checked, the State value is "on", so that works as well.
I'm not sure what the fix for this is, just yet. I ended up working around it by inverting the logic (the checkbox label is "Hide ..." instead of "Show ...")