I have a quick question about adding Zend_Dojo_Form into Zend_layouts.
I have a Zend_Dojo_Form that I want to display in the layout that is used for a particular controller. I can add the form to the layout without any issue however the dojo elements fail to render, as they would do if I added the form to a standard view.
Is there any reason why this would be the case? Do I need to do something to the layout so that it will enable the components for this embedded form in the layout. Any other dojo enabled forms that are added in the view using this layout work fine.
My form is created in the usual way:
class QuickAddJobForm extends Zend_Dojo_Form{
public function init(){
$this->setName('quickaddjobfrm')
->setMethod('post')
->setAction('/addjob/start/);
/*We now create the elements*/
$jobTitle = new Zend_Dojo_Form_Element_TextBox('jobtitle',
array(
'trim' => true
)
);
$jobTitle->setAttrib('style', 'width:200px;')
->addFilter('StripTags')
->removeDecorator('DtDdWrapper')
->removeDecorator('HtmlTag')
->removeDecorator('Label');
....
$this->addElements(array($jobTitle, ....));
In the controller I declare the layout and the form in the init function:
public function init(){
$this->_helper->layout->setLayout('add-layout');
$form = new QuickAddJobForm();
$form->setDecorators(array(array('ViewScript', array('viewScript' => 'quickAddJobFormDecorator.phtml'))));
$this->_helper->layout()->quickaddjob = $form;
In my layout Where I want the form I have:
echo $this->layout()->quickaddjob;
Why would adding this form in the layout fail to render/add the Dojo elements? All that is currently being displayed are text boxes, rather than some of the other components such as ComboBoxes/FilteringSelects etc...
Thanks in advance.
If you use Zend_Dojo_Forms in your layout be sure to render them before calling
echo $this->dojo();
You can do that with something like that:
This is what I have in my layout.phtml
In my bootstrap I use
Now I can call $this->form anytime in my view scripts, and the Dojo renders properly
The problem I have is I can't cant Dojo to render a form in Modal window
Iam not 100% Sure, but i think you must add Dojo to your Application. Try
in your Layout.phtml