I have a Zend_Dojo_Form which I have moved from my view (where it works fine) to my layout, as it's something that will be useful on every page. However in the layout the form no longer works - none of the dijit elements appear and it behaves just as a normal HTML form would.
Here's the relevant part of my bootstrap:
protected function _initView()
{
Zend_Layout::startMvc(array(
'layoutPath' => '../application/layouts',
'layout' => 'default'
));
$view = new Zend_View();
$view->setEncoding('UTF-8')
->doctype('HTML5');
// init Dojo
Zend_Dojo::enableView($view);
$view->dojo()->enable()
->setCdnVersion('1.5')
->requireModule('dojo.data.ItemFileWriteStore')
[...]
->addStyleSheetModule('dijit.themes.tundra');
// assign the view to the viewRenderer, so it will be used by the MVC actions
$viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer');
$viewRenderer->setView($view);
return $view;
}
there are no errors (JS or ZF), the form just doesn't work as it should.
I assume I need to Dojo enable the Layout view in some way. I tried changing the layout part of the bootstrap method above to this:
$layout = Zend_Layout::startMvc(array(
'layoutPath' => '../application/layouts',
'layout' => 'default'
));
$view = $layout->getView();
Zend_Dojo::enableView($view);
$layout->setView($view);
but that didn't make any difference.
I found this question which sounds very similar to my problem, but the accepted answer just shows including the dojo helper in the layout, which I am doing already.