I am new in magento and trying to use admin grid.admin grid is working fine but add and edit page is showing blank page. Is there any problem in my code.
Action from controller.
public function editAction()
{
$testId = $this->getRequest()->getParam('info_id');
$testModel = Mage::getModel('test/info')->load($testId);
if ($testModel->getInfoId() || $testId == 0)
{
Mage::register('test_data', $testModel);
$this->loadLayout();
$this->_setActiveMenu('test/info_book');
$this->_addBreadcrumb('test Manager', 'test Manager');
$this->_addBreadcrumb('Test Description', 'Test Description');
$this->getLayout()->getBlock('head')
->setCanLoadExtJs(true);
$this->_addContent($this->getLayout()
->createBlock('test/adminhtml_info_edit'))
->_addLeft($this->getLayout()
->createBlock('test/adminhtml_info_edit_tabs')
);
var_dump($this->getLayout()->getUpdate()->getHandles());
$this->renderLayout();
}
else
{
Mage::getSingleton('adminhtml/session')
->addError('Test does not exist');
$this->_redirect('*/*/');
}
}
Info edit from block
class Demo_Test_Block_Adminhtml_Info_Edit extends
Mage_Adminhtml_Block_Widget_Form_Container{
public function __construct()
{
parent::__construct();
$this->_objectId = 'id';
$this->_blockGroup = 'test';
$this->_controller = 'adminhtml_info';
$this->_updateButton('save', 'label','save reference');
$this->_updateButton('delete', 'label', 'delete reference');
}
public function getHeaderText()
{
return 'Add a contact';
}
}
Info edit from
class Demo_Test_Block_Adminhtml_Info_Edit_Form extends
Mage_Adminhtml_Block_Widget_Form
{
protected function _prepareForm()
{
$form = new Varien_Data_Form(
array(
'id' => 'edit_form',
'action' => $this->getUrl('*/*/save', array('info_id' => $this->getRequest()->getParam('info_id'))
),
'method' => 'post',
)
);
$form->setUseContainer(true);
$this->setForm($form);
return parent::_prepareForm();
}
}
conf file
<test_adminhtml_index_index>
<reference name="content">
<block type="test/adminhtml_grid" name="info_list" />
</reference>
</test_adminhtml_index_index>
<test_adminhtml_index_edit>
<reference name="content">
<block type="test/adminhtml_info_edit" name="info_edit" />
</reference>
<reference name="left">
<block type="test/adminhtml_info_edit_tabs" name="info_tabs"></block>
</reference>
</test_adminhtml_index_edit>