Form container can't set child form / create form blockHow to change admin login template in Magento 1.5 or...

Is it possible to stack the damage done by the Absorb Elements spell?

Worshiping one God at a time?

Relation between independence and correlation of uniform random variables

Using Past-Perfect interchangeably with the Past Continuous

In Aliens, how many people were on LV-426 before the Marines arrived​?

Bash - pair each line of file

What is the term when voters “dishonestly” choose something that they do not want to choose?

Suggestions on how to spend Shaabath (constructively) alone

Do I need to be arrogant to get ahead?

PTIJ What is the inyan of the Konami code in Uncle Moishy's song?

Should I be concerned about student access to a test bank?

Knife as defense against stray dogs

Can a wizard cast a spell during their first turn of combat if they initiated combat by releasing a readied spell?

Deletion of copy-ctor & copy-assignment - public, private or protected?

Variable completely messes up echoed string

Could Sinn Fein swing any Brexit vote in Parliament?

Is honey really a supersaturated solution? Does heating to un-crystalize redissolve it or melt it?

Probably overheated black color SMD pads

Practical application of matrices and determinants

Loading the leaflet Map in Lightning Web Component

When did antialiasing start being available?

What are substitutions for coconut in curry?

A Ri-diddley-iley Riddle

Does the attack bonus from a Masterwork weapon stack with the attack bonus from Masterwork ammunition?



Form container can't set child form / create form block


How to change admin login template in Magento 1.5 or 1.6Exclude a specific categoryMagento Adminhtml createblock() Form 'Mage_Core_Exception' Ivalid Block TypeFatal error: Call to a member function setData() on a non-objectFresh install, no plug ins, fatal error on category management pageError when creating an Edit Block: Fatal error: Call to a member function setData()Why does my view page not load in Admin Panel?How to Display the Product Thumbnail Image in Admin FormForm is not displayed on panel admin Magento 2Getting error “Call to a member function setTitle()” after install extension













1















My goal is to have a form into a form container. When I call directly my form in my controller, it works, but when I call the container, I have this issue :




Fatal error: Call to a member function setData() on boolean in app/code/core/Mage/Adminhtml/Block/Widget/Form/Container.php on line 144




The code line is :



public function getFormHtml() {
$this->getChild('form')->setData('action', $this->getSaveUrl());
return $this->getChildHtml('form');
}


And this refers to another line :



protected function _prepareLayout() {
if ($this->_blockGroup && $this->_controller && $this->_mode) {
$this->setChild('form', $this->getLayout()->createBlock($this->_blockGroup
. '/'
. $this->_controller
. '_'
. $this->_mode
. '_form'
)
);
}
return parent::_prepareLayout();
}


I've tried to tweak values of _blockGroup, _controller and _mode, but nothing works ...



My form container class :



class Cheek_Portraits_Block_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
{
public function __construct()
{
$helper = Mage::helper('portraits');
$this->_blockGroup = 'portraits';
$this->_controller = 'page';
$this->_mode = 'edit';

if($this->getRequest()->getParam('id'))
{
$this->_headerText = $helper->__('Edit')." portrait";
}
else
{
$this->_headerText = $helper->__('New')." portrait";
}
parent::__construct();
}
}


Here my folders and files :





I also tried like this :












share|improve this question





























    1















    My goal is to have a form into a form container. When I call directly my form in my controller, it works, but when I call the container, I have this issue :




    Fatal error: Call to a member function setData() on boolean in app/code/core/Mage/Adminhtml/Block/Widget/Form/Container.php on line 144




    The code line is :



    public function getFormHtml() {
    $this->getChild('form')->setData('action', $this->getSaveUrl());
    return $this->getChildHtml('form');
    }


    And this refers to another line :



    protected function _prepareLayout() {
    if ($this->_blockGroup && $this->_controller && $this->_mode) {
    $this->setChild('form', $this->getLayout()->createBlock($this->_blockGroup
    . '/'
    . $this->_controller
    . '_'
    . $this->_mode
    . '_form'
    )
    );
    }
    return parent::_prepareLayout();
    }


    I've tried to tweak values of _blockGroup, _controller and _mode, but nothing works ...



    My form container class :



    class Cheek_Portraits_Block_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
    {
    public function __construct()
    {
    $helper = Mage::helper('portraits');
    $this->_blockGroup = 'portraits';
    $this->_controller = 'page';
    $this->_mode = 'edit';

    if($this->getRequest()->getParam('id'))
    {
    $this->_headerText = $helper->__('Edit')." portrait";
    }
    else
    {
    $this->_headerText = $helper->__('New')." portrait";
    }
    parent::__construct();
    }
    }


    Here my folders and files :





    I also tried like this :












    share|improve this question



























      1












      1








      1








      My goal is to have a form into a form container. When I call directly my form in my controller, it works, but when I call the container, I have this issue :




      Fatal error: Call to a member function setData() on boolean in app/code/core/Mage/Adminhtml/Block/Widget/Form/Container.php on line 144




      The code line is :



      public function getFormHtml() {
      $this->getChild('form')->setData('action', $this->getSaveUrl());
      return $this->getChildHtml('form');
      }


      And this refers to another line :



      protected function _prepareLayout() {
      if ($this->_blockGroup && $this->_controller && $this->_mode) {
      $this->setChild('form', $this->getLayout()->createBlock($this->_blockGroup
      . '/'
      . $this->_controller
      . '_'
      . $this->_mode
      . '_form'
      )
      );
      }
      return parent::_prepareLayout();
      }


      I've tried to tweak values of _blockGroup, _controller and _mode, but nothing works ...



      My form container class :



      class Cheek_Portraits_Block_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
      {
      public function __construct()
      {
      $helper = Mage::helper('portraits');
      $this->_blockGroup = 'portraits';
      $this->_controller = 'page';
      $this->_mode = 'edit';

      if($this->getRequest()->getParam('id'))
      {
      $this->_headerText = $helper->__('Edit')." portrait";
      }
      else
      {
      $this->_headerText = $helper->__('New')." portrait";
      }
      parent::__construct();
      }
      }


      Here my folders and files :





      I also tried like this :












      share|improve this question
















      My goal is to have a form into a form container. When I call directly my form in my controller, it works, but when I call the container, I have this issue :




      Fatal error: Call to a member function setData() on boolean in app/code/core/Mage/Adminhtml/Block/Widget/Form/Container.php on line 144




      The code line is :



      public function getFormHtml() {
      $this->getChild('form')->setData('action', $this->getSaveUrl());
      return $this->getChildHtml('form');
      }


      And this refers to another line :



      protected function _prepareLayout() {
      if ($this->_blockGroup && $this->_controller && $this->_mode) {
      $this->setChild('form', $this->getLayout()->createBlock($this->_blockGroup
      . '/'
      . $this->_controller
      . '_'
      . $this->_mode
      . '_form'
      )
      );
      }
      return parent::_prepareLayout();
      }


      I've tried to tweak values of _blockGroup, _controller and _mode, but nothing works ...



      My form container class :



      class Cheek_Portraits_Block_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
      {
      public function __construct()
      {
      $helper = Mage::helper('portraits');
      $this->_blockGroup = 'portraits';
      $this->_controller = 'page';
      $this->_mode = 'edit';

      if($this->getRequest()->getParam('id'))
      {
      $this->_headerText = $helper->__('Edit')." portrait";
      }
      else
      {
      $this->_headerText = $helper->__('New')." portrait";
      }
      parent::__construct();
      }
      }


      Here my folders and files :





      I also tried like this :









      magento-1.9 adminhtml forms






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 29 mins ago









      Teja Bhagavan Kollepara

      3,00641949




      3,00641949










      asked Jan 8 at 13:53









      EzwanEzwan

      62




      62






















          1 Answer
          1






          active

          oldest

          votes


















          0














          Check if you really created the the Form.php file from Yourmodule/Yournamespace/Block/Adminhtml/Page/Edit/Form.php



          please make sure you have this method inside:



              protected function _prepareForm()
          {
          $form = new Varien_Data_Form(
          [
          'id' => 'edit_form',
          'action' => $this->getUrl(
          '*/*/save',
          [
          'id' => $this->getRequest()->getParam('id')
          ]
          ),
          'method' => 'post',
          'enctype' => 'multipart/form-data'
          ]
          );
          $form->setUseContainer(true);
          $this->setForm($form);
          return parent::_prepareForm();
          }


          For me missing that file caused this error.






          share|improve this answer























            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "479"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f257138%2fform-container-cant-set-child-form-create-form-block%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            Check if you really created the the Form.php file from Yourmodule/Yournamespace/Block/Adminhtml/Page/Edit/Form.php



            please make sure you have this method inside:



                protected function _prepareForm()
            {
            $form = new Varien_Data_Form(
            [
            'id' => 'edit_form',
            'action' => $this->getUrl(
            '*/*/save',
            [
            'id' => $this->getRequest()->getParam('id')
            ]
            ),
            'method' => 'post',
            'enctype' => 'multipart/form-data'
            ]
            );
            $form->setUseContainer(true);
            $this->setForm($form);
            return parent::_prepareForm();
            }


            For me missing that file caused this error.






            share|improve this answer




























              0














              Check if you really created the the Form.php file from Yourmodule/Yournamespace/Block/Adminhtml/Page/Edit/Form.php



              please make sure you have this method inside:



                  protected function _prepareForm()
              {
              $form = new Varien_Data_Form(
              [
              'id' => 'edit_form',
              'action' => $this->getUrl(
              '*/*/save',
              [
              'id' => $this->getRequest()->getParam('id')
              ]
              ),
              'method' => 'post',
              'enctype' => 'multipart/form-data'
              ]
              );
              $form->setUseContainer(true);
              $this->setForm($form);
              return parent::_prepareForm();
              }


              For me missing that file caused this error.






              share|improve this answer


























                0












                0








                0







                Check if you really created the the Form.php file from Yourmodule/Yournamespace/Block/Adminhtml/Page/Edit/Form.php



                please make sure you have this method inside:



                    protected function _prepareForm()
                {
                $form = new Varien_Data_Form(
                [
                'id' => 'edit_form',
                'action' => $this->getUrl(
                '*/*/save',
                [
                'id' => $this->getRequest()->getParam('id')
                ]
                ),
                'method' => 'post',
                'enctype' => 'multipart/form-data'
                ]
                );
                $form->setUseContainer(true);
                $this->setForm($form);
                return parent::_prepareForm();
                }


                For me missing that file caused this error.






                share|improve this answer













                Check if you really created the the Form.php file from Yourmodule/Yournamespace/Block/Adminhtml/Page/Edit/Form.php



                please make sure you have this method inside:



                    protected function _prepareForm()
                {
                $form = new Varien_Data_Form(
                [
                'id' => 'edit_form',
                'action' => $this->getUrl(
                '*/*/save',
                [
                'id' => $this->getRequest()->getParam('id')
                ]
                ),
                'method' => 'post',
                'enctype' => 'multipart/form-data'
                ]
                );
                $form->setUseContainer(true);
                $this->setForm($form);
                return parent::_prepareForm();
                }


                For me missing that file caused this error.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Feb 19 at 8:46









                Attila NaghiAttila Naghi

                1,54722043




                1,54722043






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Magento Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f257138%2fform-container-cant-set-child-form-create-form-block%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    “%fieldName is a required field.”, in Magento2 REST API Call for GET Method Type The Next...

                    How to change City field to a dropdown in Checkout step Magento 2Magento 2 : How to change UI field(s)...

                    變成蝙蝠會怎樣? 參考資料 外部連結 导航菜单Thomas Nagel, "What is it like to be a...