If you are someone who develops Magento extensions for store admins or who deliver work to another developer, bookmarking this post might be of help!
The post gives the method to create input tag with disabled attribute in Magento system.xml.
For example, you are developing a module that requires an external API integration. You don’t want the user to change the API details from the backend even though he has the access to the admin panel and configuration of the extension.
In that case, you can simply disable the fields that you want not to be changed.
Other examples where you can implement this solution is when you don’t want the user to change the password, selected countries that are allowed to use a specific feature, etc.
Disable the attribute in Magento system.xml to get the result as shown below:

Method to Create Input Tag With Disabled Attribute in Magento system.xml:
Find if the field code in system.xml is as below:
<token translate="label"> <label>Auth Token</label> <frontend_type>text</frontend_type> <sort_order>10</sort_order> <show_in_default>1</show_in_default> <show_in_website>0</show_in_website> <show_in_store>0</show_in_store> </token>
and replace it with the below:
<token translate="label"> <label>Auth Token</label> <frontend_type>text</frontend_type> <frontend_model>Vendor_Extension_Block_Field_Disable</frontend_model> <sort_order>10</sort_order> <show_in_default>1</show_in_default> <show_in_website>0</show_in_website> <show_in_store>0</show_in_store> </token>
Create a new file Disable.php at Vendor\Extension\Block\Field folder
<?php class Vendor_Extension_Block_Field_Disable extends Mage_Adminhtml_Block_System_Config_Form_Field{ protected function _getElementHtml($element) { $element->setDisabled('disabled'); return parent::_getElementHtml($element); } }
That’s it.
Secure your configuration with the above code.
Do not forget to share the solution with fellow developers!
Thanks.