I am working on Magento community edition 1.7 version. I have a grid in admin when I click on "Add New" from this grid a form appear but it has some tabs in left side.I need to remove that tabs and want only form.
app/code/community/namespace/test/Block/Adminhtml/test/Edit/Tabs.php
My code for tabs in above file is:
protected function _beforeToHtml() {
$this->addTab('form_section', array(
'label' => Mage::helper('test')->__('Book'),
'title' => Mage::helper('test')->__('Book'),
'content' => $this->getLayout()->createBlock('test/adminhtml_book_edit_tab_form')->toHtml(),
));
return parent::_beforeToHtml();
}
Can anyone solve this problem?
In your Admin controller
please see editAction
$this->_addContent($this->getLayout()->createBlock('<module>/adminhtml_<module>_edit'))
->_addLeft($this->getLayout()->createBlock('<module>/adminhtml_<module>_edit_tabs'));
remove
->_addLeft($this->getLayout()->createBlock('<module>/adminhtml_<module>_edit_tabs'));
then create file name form.php in
app/code/community/namespace/test/Block/Adminhtml/test/Edit/Form.php
and paste the code in
class <Namespace>_<Module>_Block_Adminhtml_<Module>_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
{
protected function _prepareForm()
{
$<module>Form = new Varien_Data_Form(array(
'id' => 'edit_form',
'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
'method' => 'post',
));
$<module>Form->setUseContainer(true);
$this->setForm($<module>Form);
$fieldset = $<module>Form->addFieldset('<module>_form', array(
'legend' => Mage::helper('<module>')->__('Item Information'),
'class' => 'fieldset-wide',
)
);
$fieldset->addField('<module>_name', 'text', array(
'label' => Mage::helper('<module>')->__('Name'),
'class' => 'required-entry',
'required' => true,
'name' => 'name',
));
if ( Mage::getSingleton('adminhtml/session')->get<Module>Data() )
{
$<module>Form -> setValues(Mage::getSingleton('adminhtml/session')->get<Module>Data());
Mage::getSingleton('adminhtml/session')->get<Module>Data(null);
} elseif ( Mage::registry('<module>_data') ) {
$<module>Form-> setValues(Mage::registry('<module>_data')->getData());
}
return parent::_prepareForm();
}
}