Magento does not store 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 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
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.
source to share