Magento Form Block not rendered

Wednesday, November 4, 2015

I am trying to make a real grid based on a magento model.
Everything is working well on the read part, but the form to edit isnt rendered and i have no errors in logs.
I noticed that my _prepareForm function is never called, but I don't know why.



My form call in controller:



public function editAction()
{
$this->_initAction();

// Get id if available
$id = $this->getRequest()->getParam('contact_request_id');
$model = Mage::getModel('aeschbach_booking/contactRequest');

if ($id) {
// Load record
$model->load($id);

// Check if record is loaded
if (!$model->getId()) {
Mage::getSingleton('adminhtml/session')->addError($this->__('This Contact Request no longer exists.'));
$this->_redirect('*/*/');

return;
}
}

$this->_title($model->getId() ? $model->getName() : $this->__('New Contact Request'));

$data = Mage::getSingleton('adminhtml/session')->getContactRequestData(true);
if (!empty($data)) {
$model->setData($data);
}

Mage::register('aeschbach_booking', $model);

$this->_addBreadcrumb($id ? $this->__('Edit Contact Request') : $this->__('New Contact Request'), $id ? $this->__('Edit Contact Request') : $this->__('New Contact Request'));
$block = $this->getLayout()->createBlock('aeschbach_booking/adminhtml_contactRequest_edit')->setData('action', $this->getUrl('*/*/save'));
$this->getLayout()->getBlock('content')->append($block);

$this->renderLayout();
}


And my form :



class Whatever_Booking_Block_Adminhtml_ContactRequest_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
{
/**
* Init class
*/
public function _construct()
{
parent::_construct();
$this->setId('aeschbach_booking_contactRequest_form');
$this->setTitle($this->__('Contact Request Information'));
//when i var dump here i see that my controller called this function
}

protected function _prepareForm()
{
var_dump('here');
die; // this var dump is never reached
}
}

0 comments:

Post a Comment