Can anyone tell my how I can show a select box field in the system configuration as disabled?

I want to have a status field that shows the status of a job (running/not running). When the value is "running" I want to show a button that can stop the job.

My current approach is to have a <frontend_type>select</frontend_type> for the status and the button uses <depends> in order to decide if it is shown or not. So far this works as expected. But I don't want the select to be editable. Varien_Data_Form_Element_Select checks for attributes like readonly and disabled but how can I activate them? Is there a simple solution besides writing a custom frontend_model?

As a sidenote: I would not need a select box to do this. A label would be more than enough. Unfortunately the Magento's form.js seems to stick to input or select when checking depends

Thanks in advance! :-)

1 Answer 1


You can specify a frontend model to your field like this:

<field_name translate="label">
    <label>Field name</label>
    <frontend_model>module/field_name_renderer</frontend_model><!-- this is it -->

Now you have to create the class for that frontend model. This is not actually a model it's a block.

class Namespace_Module_Block_Field_Name_Renderer extends Mage_Adminhtml_Block_System_Config_Form_Field{
    protected function _getElementHtml($element) {
        if (YOUR CONDITION HERE) {
        return parent::_getElementHtml($element);

As for side note...I have no idea...yet.

  • Thanks Marius. Beside accepting this as the correct answer: Can you tell me where exactly the Varien_Data_Form_Element is created? Just curious :) Nov 6, 2013 at 15:47
  • @Celldweller. I'm not sure I understand what you mean but I will shoot in the dark with this Mage_Adminhtml_Block_System_Config_Form::initFields
    – Marius
    Nov 6, 2013 at 15:49
  • Hit! I guess... ;-) Thx! Nov 6, 2013 at 15:58
  • you should wrap the code and if inside a method :) Feb 2, 2015 at 19:03
  • 1
    @FabianBlechschmidt. Thanks. I got all excited about the code that I forgot the method name. :)
    – Marius
    Feb 2, 2015 at 19:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.