0

I made a Magento Admin form before and it was ok. But with help of this tutorial, I added tabs to it. But in HTML output, I have two form tag. one of the has the content of the form and form key and the other just has the form key.

tow headers for one form

The problem is company_Vendor_Block_Adminhtml_Vendor_Edit_Form._prepareForm() is run two times. So it makes two form and I think, it runs two times because of this line in vendorController.EditAction()

$this->_addContent($this->getLayout()->createBlock('vendor/adminhtml_vendor_edit'))
->_addLeft($this->getLayout()
  ->createBlock('vendor/adminhtml_vendor_edit_tabs'));

when I just have createBlock('vendor/adminhtml_vendor_edit') this is run only one-time but when I add the tab to left it is run two times. How Can I Solve It?

NOTE: My code is Exactly the same as the tutorial.

  • Welcome to SE. Pls specify your magento version. – Priyank Jul 15 '18 at 3:14
0

I found the solution. The problem was about an extra(useless) XML layout file. So renderLayout() make an extra form.ithe problem can be solved by removing XML file from layout or just convert

 $this->_addContent($this->getLayout()->createBlock('vendor/adminhtml_vendor_edit'))->_addLeft($this->getLayout()->createBlock('vendor/adminhtml_vendor_edit_tabs'));

TO

$this->_addLeft($this->getLayout()->createBlock('vendor/adminhtml_vendor_edit_tabs'));

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.