Magento does not store value on 'save'

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


class NS_MN_Block_Cms_Page_Edit_Tab_Main extends Mage_Adminhtml_Block_Cms_Page_Edit_Tab_Main

public function _prepareForm()

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

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


I added a field bar

to the table cms_page

and the field is displayed, but when I save the cms page, this field is not saved to the database.

Can anyone tell me that I am overlooking here?


source to share

2 answers

You need to remember to clear the cache. This man caught me several times.

Go to System > Cache Management

and press both clear buttons.

Log out of administrator and login. Everything must function properly.



Have you added this field to the database? Having a field in a form is one step, but in order to save data, it must be able to live in a column in the DB. Once the field is in the database, you may need to change the controller to recognize the new field, but it may work for all fields already. If it's already executing setData($data)

where $data

is all the received form data, you should be fine.



All Articles