I created a form in the adminhtml, all other fields are working well (ie., text, select, etc). However, I tried adding a button in the list of fields but it seems it's not picking up the value:

$fieldset->addField('test_button', 'button', array(
            'name'      => 'test_button',
            'value'     => 'Test Me',
            'label'     => 'Click the button to test',

Output is just:

<input id="test_button" name="test_button" value="" type="button">

Note that the value is empty, thus button is just a blank button.

2 Answers 2


I got it now, instead of using $form->setValues(), I used $form->addValues() as the former overrides the value of the fields.


If we want to show the provided value for the button than we have to change the function _prepareForm() used to load the admin form to use function addValues() instead of setValues().

protected function _prepareForm()
    //create form structure
    $this->_form = new Varien_Data_Form();
    $this->model = Mage::registry('Namespace_Module');


    //set form values
    $data = Mage::getSingleton('adminhtml/session')->getFormData();

    if ($data) {
    elseif ($this->model) {
        //Using addValues() instead of setValues()

    return parent::_prepareForm();

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.