I just figured out that the form fields in Magento, while using checkbox, it sends on as its value when it is checked and nothing when unchecked. Now if it is on once it is never set as off in Db
core_config_data table. Why has Magento made design like that in its JS?
For system configuration fields, use dropdowns instead of checkboxes. For example, if you have a field called
Enabled, use a dropdown with the values
Yes (1) and
No (0). Don't use a checkbox because the
off value is never sent (in fact, an
off value doesn't exist - there is only an
Why has Magento made design like that in its JS?
I think because you did it that way in the past. There was no need to add a hidden field right before to make sure the value is either 0 or 1 (I guess you mean this?).
If you are checking a boolean magento value, you want to use
\Mage::getStoreConfigFlag, so you get either
false. It doesn't matter if the value is set.