Hi,
I have some custom system configuration where a checkbox is used so the user can make a choice between on or off.
After checking it and clicking "Save Config" the page reloads with the checkbox unchecked (so unsaved) but with the "The configuration has been saved." message.
So the question is:
How can I keep using this checkbox or should I switch to a select like so many others?
My code:
<enable translate="label"> <label>Enable logging of requests and responses</label> <frontend_type>checkbox</frontend_type> <sort_order>0</sort_order> <show_in_default>1</show_in_default> </enable>
@calidris Try below code:
<enable translate="label"> <label>Enable logging of requests and responses</label> <frontend_type>checkbox</frontend_type> <validate>required-entry</validate> <sort_order>15</sort_order> <show_in_default>1</show_in_default> <show_in_website>0</show_in_website> <show_in_store>0</show_in_store> </enable>
Cheers
Hi @GauravMehta04,
Sorry, it won't work.
It just displays a "required entry" message.
I know it has something to do that with other types of input fields it's the value which is important (and saved) but with checkboxes it's the checked attribute which is important and should be saved.
Am I looking for something impossible and if so why are checkboxes even possible in Magento then?