- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Checkbox in system configuration not saving
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>
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Checkbox in system configuration not saving
@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
Magento Programmer | Was my answer helpful? You can accept it as a solution.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Checkbox in system configuration not saving
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?