Search code examples
magentosaveblockadminhtml

Magento doesn't save value on 'save'


I have a custom module that adds a field to an element in

<?php

class NS_MN_Block_Cms_Page_Edit_Tab_Main extends Mage_Adminhtml_Block_Cms_Page_Edit_Tab_Main
{

public function _prepareForm()
{
parent::_prepareForm();

 $fieldset = $this->getForm()->getElements()->searchById('base_fieldset');

$fieldset->addField('bar', 'text',
    array(
        'label' => Mage::helper('cms')->__('BaR'),
        'class' => 'input-text',
        'name'  => 'bar',
        'required' => false
    )
);
return $this;
}
}

I have added the bar field into the cms_page table and the field is rendered, but when I save the cms page, the field is not saved to the database.

Could anyone tell me what I am overlooking here?


Solution

  • You need to remember to flush your cache. This one has caught me out a few times before.

    Go into System > Cache Management and click both flush buttons.

    Log out of the admin and log back in. Everything should function as expected.