cancel
Showing results for 
Search instead for 
Did you mean: 

Checkbox in system configuration not saving

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>
2 REPLIES 2

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.

Re: Checkbox in system configuration not saving

Hi @GauravMehta04,

 

Sorry, it won't work.

It just displays a "required entry" message.

 

This is a required field

 

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?