I have a Zend_Dojo_Form, which I have moved from my view (where it works fine) to my layout, as it will be useful on every page. However, in the layout, the form no longer works - not one of the dijit elements appears, and it behaves in the same way as a regular HTML form.
Here is the relevant part of my boot file:
protected function _initView()
{
Zend_Layout::startMvc(array(
'layoutPath' => '../application/layouts',
'layout' => 'default'
));
$view = new Zend_View();
$view->setEncoding('UTF-8')
->doctype('HTML5');
Zend_Dojo::enableView($view);
$view->dojo()->enable()
->setCdnVersion('1.5')
->requireModule('dojo.data.ItemFileWriteStore')
[...]
->addStyleSheetModule('dijit.themes.tundra');
$viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer');
$viewRenderer->setView($view);
return $view;
}
There are no errors (JS or ZF), the form simply does not work as it should.
I assume that I need Dojo to include the Layout view in some way. I tried changing the layout part of the boot method above:
$layout = Zend_Layout::startMvc(array(
'layoutPath' => '../application/layouts',
'layout' => 'default'
));
$view = $layout->getView();
Zend_Dojo::enableView($view);
$layout->setView($view);
but it didn’t matter.
I found this question that is very similar to my problem, but the accepted answer just shows, including the Dojo helper in the layout that I am already doing.