title: Magento admin issue
body: <p>Hi I'm creating my first admin section for my extension. I've created a menu which links to a page displaying a grid. The problem is when you click through to edit the record, its displaying this error </p>
  
  <blockquote>
    <p>Fatal error: Call to a member function setData() on a non-object in /Applications/MAMP/htdocs/theBookClub/app/code/core/Mage/Adminhtml/Block/Widget/Form/Container.php on line 129</p>
  </blockquote>
  
  <p>For the life of me I can't see any reference in any of the relevant files</p>
  
  <pre><code>class Namespace_Bookshelf_Block_Adminhtml_Bookshelf_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
  {
     public function __construct()
  {
      parent::__construct();
  
      $this-&gt;_objectId = 'id';
      $this-&gt;_blockGroup = 'bookshelf';
      $this-&gt;_controller = 'bookshelf_admin';
      $this-&gt;_mode = 'edit';
  
      $this-&gt;_addButton('save_and_continue', array(
                'label' =&gt; Mage::helper('adminhtml')-&gt;__('Save And Continue Edit'),
                'onclick' =&gt; 'saveAndContinueEdit()',
                'class' =&gt; 'save',
      ), -100);
      $this-&gt;_updateButton('save', 'label', Mage::helper('bookshelf')-&gt;__('Save Example'));
  
      $this-&gt;_formScripts[] = "
          function toggleEditor() {
              if (tinyMCE.getInstanceById('form_content') == null) {
                  tinyMCE.execCommand('mceAddControl', false, 'edit_form');
              } else {
                  tinyMCE.execCommand('mceRemoveControl', false, 'edit_form');
              }
          }
  
          function saveAndContinueEdit(){
              editForm.submit($('edit_form').action+'back/edit/');
          }
      ";
  }
  
  public function getHeaderText()
  {
      if (Mage::registry('example_data') &amp;&amp; Mage::registry('example_data')-&gt;getId())
      {
          return Mage::helper('bookshelf')-&gt;__('Edit Example "%s"', $this-&gt;htmlEscape(Mage::registry('example_data')-&gt;getName()));
      } else {
          return Mage::helper('bookshelf')-&gt;__('New Example');
      }
  }
  </code></pre>
  
  <p>and this</p>
  
  <pre><code>class Namespace_Bookshelf_Block_Adminhtml_Bookshelf_Grid extends                Mage_Adminhtml_Block_Widget_Grid {
  
  public function __construct() {
      parent::__construct();
      $this-&gt;setId('bookshelf_grid');
      $this-&gt;setDefaultSort('bookshelf_id');
      $this-&gt;setDefaultDir('desc');
      $this-&gt;setSaveParametersInSession(true);
  }
  
  protected function _prepareCollection() {
      $collection = Mage::getModel('bookshelf/bookshelf')-&gt;getCollection();
      $this-&gt;setCollection($collection);
      return parent::_prepareCollection();
  }
  
  protected function _prepareColumns() {
      $this-&gt;addColumn('bookshelf_id', array(
          'header' =&gt; Mage::helper('bookshelf')-&gt;__('ID'),
          'align' =&gt; 'right',
          'width' =&gt; '50px',
          'index' =&gt; 'bookshelf_id',
      ));
  
      $this-&gt;addColumn('customer_id', array(
          'header' =&gt; Mage::helper('bookshelf')-&gt;__('Name'),
          'align' =&gt; 'left',
          'index' =&gt; 'customer_id',
      ));
  
      $this-&gt;addColumn('bookshelf_name', array(
          'header' =&gt; Mage::helper('bookshelf')-&gt;__('Name'),
          'align' =&gt; 'left',
          'index' =&gt; 'bookshelf_name',
      ));
  
  
  
      return parent::_prepareColumns();
  }
  
  
  
  
  
  public function getRowUrl($row) {
      return $this-&gt;getUrl('*/*/edit', array('id' =&gt; $row-&gt;getId()));
  }
  </code></pre>
  
  <p>}</p>
  
  <p>and this</p>
  
  <pre><code>class Newdaymedia_Bookshelf_Block_Adminhtml_Bookshelf extends
  Mage_Adminhtml_Block_Widget_Grid_Container
  {
  public function __construct()
  {
  $this-&gt;_controller = 'bookshelf_admin';
  $this-&gt;_blockGroup = 'bookshelf';
  $this-&gt;_headerText = Mage::helper('bookshelf')-&gt;__('Item Manager');
  $this-&gt;_addButtonLabel = Mage::helper('bookshelf')-&gt;__('Add Item');
  parent::__construct();
  }
  
  protected function _prepareLayout()
   {
     $this-&gt;setChild( 'grid',
         $this-&gt;getLayout()-&gt;createBlock( $this-&gt;_blockGroup.'/' . $this-&gt;_controller . '_grid',
         $this-&gt;_controller . '.grid')-&gt;setSaveParametersInSession(true) );
     return parent::_prepareLayout();
   }
  }
  </code></pre>
  
  <p>Any help would be gratefully received!</p>
  
  <p>NEW</p>
  
  <pre><code>class Namespace_Bookshelf_Block_Adminhtml_Bookshelf_Edit_Form extends     Mage_Adminhtml_Block_Widget_Form
  {
  protected function _prepareForm()
  {
      if (Mage::getSingleton('adminhtml/session')-&gt;getExampleData())
      {
          $data = Mage::getSingleton('adminhtml/session')-&gt;getExamplelData();
          Mage::getSingleton('adminhtml/session')-&gt;getExampleData(null);
      }
      elseif (Mage::registry('example_data'))
      {
          $data = Mage::registry('example_data')-&gt;getData();
      }
      else
      {
          $data = array();
      }
      Mage::log("this is the form class");
      $form = new Varien_Data_Form(array(
              'id' =&gt; 'edit_form',
              'action' =&gt; $this-&gt;getUrl('*/*/save', array('id' =&gt; $this-&gt;getRequest()-&gt;getParam('id'))),
              'method' =&gt; 'post',
              'enctype' =&gt; 'multipart/form-data',
      ));
  
      $form-&gt;setUseContainer(true);
  
      $this-&gt;setForm($form);
  
      $fieldset = $form-&gt;addFieldset('example_form', array(
           'legend' =&gt;Mage::helper('bookshelf')-&gt;__('Example Information')
      ));
  
      $fieldset-&gt;addField('name', 'text', array(
           'label'     =&gt; Mage::helper('bookshelf')-&gt;__('Name'),
           'class'     =&gt; 'required-entry',
           'required'  =&gt; true,
           'name'      =&gt; 'name',
           'note'     =&gt; Mage::helper('awesome')-&gt;__('The name of the example.'),
      ));
  
      $fieldset-&gt;addField('description', 'text', array(
           'label'     =&gt; Mage::helper('bookshelf')-&gt;__('Description'),
           'class'     =&gt; 'required-entry',
           'required'  =&gt; true,
           'name'      =&gt; 'description',
      ));
  
      $fieldset-&gt;addField('other', 'text', array(
           'label'     =&gt; Mage::helper('bookshelf')-&gt;__('Other'),
           'class'     =&gt; 'required-entry',
           'required'  =&gt; true,
           'name'      =&gt; 'other',
      ));
  
      $form-&gt;setValues($data);
  
      return parent::_prepareForm();
  }
  </code></pre>
  
  <p>}</p>