What i have tried is the following.
I have a class which extends Mage_Adminhtml_Block_Widget_Form
. Inside that i have the _prepareLayout
function. Now i have set a block inside that function like this.
echo $this->getLayout()->createBlock('adminhtml/template')->setTemplate('path/tothefile.phtml')->toHtml();
Its working. But the issue is i have a javascript code inside this .phtml file and its running twice.
May be because of the core/text_list
block type of widget
instance or for the toHtml()
. Do you guys have any idea whats wrong.
Best Answer
Add
__toHtml()
method in form container block.