Issues

ZF-9165: Zend_Dojo_Form can't have unlimited elements in setUseProgrammatic() mode

Description

When creating many elements that are to be detected by firefox 3.5.7 the zendDijits variable dissapears. I've encountered this problem when creating tabbed forms. This problem is easily overcome by setting setUseDeclarative().

I guess the Zend_Dojo_View_Helper_Dojo_Container::registerDijitLoader needs some way of noticing if amount of dijits is too large.


public function testAction(){
    $this->view->dojo()
    ->setDjConfigOption('isDebug', true)
    ->setCdnBase(Zend_Dojo::CDN_BASE_GOOGLE)
    ;

    Zend_Dojo_View_Helper_Dojo::setUseProgrammatic();

    $form  = new Zend_Dojo_Form();
    $form->setMethod('post');
    $form->setAttribs(array(
        'name'  => 'masterForm',
        'method' => 'post',
    ));

    $form->setDecorators(
        array(
            'FormElements',
            array('TabContainer',
                array(
                    'id' => 'tabContainer',
                    'style' => 'width: 800px; height: 600px',
                    'dijitParams' => array('tabPosition' => 'top')
                )
            ),
            'DijitForm',
        )
    );

    for ($i = 0 ; $i < 3 ; $i++) {
        $new_subform = new Zend_Dojo_Form_SubForm();
        $new_subform->setAttribs(array('name'   => 'sub_form_' . $i,
            'legend' => 'sub_form_' . $i,
            'dijitParams' => array(
            'title' =>'my advanced sub_form_' . $i,
            ),
            'class' => 'zend_form'
        ));

        for ($c = 0 ; $c < 140 ; $c++) {
            $element = $new_subform->createElement('NumberTextBox', 
                'test_text_' . $i . "_" . $c, 
                array('maxlength' => 10, 'label' => 'test ' . $i . "_" . $c));
            $new_subform->addElement($element);
        }

        $form->addSubForm($new_subform, 'sub_form_' . $i);
    }

    $this->view->form = $form->render();
}

Comments

After investigating, it's the same issue as ZF-10604.

Closing as a duplicate of ZF-10604