ZF-7134: When an dijit on a Zend_Dojo_Form_SubForm has a datastore, the generated JS to link the datastore uses the wrong ID.

Issue Type: Bug Created: 2009-06-26T08:46:57.000+0000 Last Updated: 2009-10-15T10:00:39.000+0000 Status: Resolved Fix version(s): - 1.9.5 (27/Oct/09)

Reporter: Joe Conigliaro (joe-w3design) Assignee: Matthew Weier O'Phinney (matthew) Tags: - Zend_Dojo

Related issues: Attachments:


When an element on a Zend_Dojo_Form_SubForm has a datastore, the generated JS to link the datastore uses the wrong ID. The id's used to be in the form of subform[element], however this has been changed to subfrom-element, and the generated JavaScript does not reflect this.

Here is a test to replicate the issue:

<pre class="highlight"> 

require_once 'Zend/Controller/Action.php';
require_once 'Zend/Dojo/Form.php';
require_once 'Zend/Dojo/Form/SubForm.php';
require_once 'Zend/Dojo/Form/Element/ComboBox.php';

class TestController extends Zend_Controller_Action 
    public function dojoTestAction() 
        // Zend_Dojo_Form
        $testForm = new Zend_Dojo_Form();
        // Create a new subform
        $testSubform = new Zend_Dojo_Form_SubForm();

        // Add a test element to the subform
        $testSubform->addElement(new Zend_Dojo_Form_Element_ComboBox('testcombo',
                'storeId'     => 'testStore',
                'storeType'   => 'test.storeType',
                'storeParams' => array(
                    'url' => 'test/store',
                'label'       => 'Test Label:',
        // Add the subform to the main form
        $testForm->addSubForm($testSubform, 'testsubform');
        echo $testForm;
        echo $this->view->dojo();


Here is the HTML:

<pre class="highlight">


And the generated JavaScript:

    <pre class="highlight">

As you can see in the generated javascript.:

    <pre class="highlight">

OR The id's should actually be testsubform[testcombo], as it was previously.



### Comments

Posted by Robert Hänsel (r-o-b-e-r-t) on 2009-08-18T00:52:56.000+0000

The Problem is in Zend/Dojo/View/Helper/comboBox.php:73

    <pre class="literal">
                if (false !== ($store = $this->_renderStore($params['store'], $id))) {

just replace with this ...

    <pre class="literal">
                if (false !== ($store = $this->_renderStore($params['store'], $attribs['id']))) {

Work fine for me



Posted by Fabien Faille (fa²) on 2009-08-28T02:34:51.000+0000

This bug isn't only for subforms but all elements with stores...

A very simple exemple :

    <pre class="highlight">
            $dojoForm = new Zend_Dojo_Form();
            $dojoForm->addElement("FilteringSelect", "elementName", array(
                'label' => "my label",
                'storeId' => "my_store_id",
                'storeType' => "",
                'storeParams' => array(
                    'url' => "/some/path"
                'attribs' => array(
                    'id' => "my_element_id"

rendered code

    <pre class="highlight">
    var my_store_id = new{"url":"\/some\/path"});
    dijit.byId("elementName").attr("store", my_store_id);

Fix given by Robert Hänsel (18/Aug/09 12:52 AM) works well, it's possible you have to make the same change on line 96...



Posted by Marcin Sikon (marphi) on 2009-09-27T13:32:41.000+0000

The bug is in file Zend/Dojo/View/Helper/ComboBox.php

    <pre class="literal"> 
    148                    . 'dijit.byId("' . $id . '").attr("store", '
    should be

148 . 'dijit.byId("' . $this->\_normalizeId($id). '").attr("store", ' {/noformat}



Posted by Matthew Weier O'Phinney (matthew) on 2009-10-15T10:00:37.000+0000

Fixed in trunk and 1.9 release branch.



Have you found an issue?

See the Overview section for more details.


© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.