views:

310

answers:

0

Hi,

I am really struggling with the FilteringSelect component in this particular form. Now I have used this component before however for some reason this one just won't populate.

I am using the Zend_Form and the form code for the filteringselect looks like this.

$universities = new Zend_Dojo_Form_Element_FilteringSelect('university');
    $universities->setAutoComplete(true)
        ->setStoreId('universitystore')
        ->setStoreType('dojo.data.ItemFileReadStore')
        ->setStoreParams(array('url' => $baseUrl.'/dojo/unilist'))
        ->setAttrib("searchAttr", "name")
        ->setRequired(true)
        ->removeDecorator('DtDdWrapper')
        ->removeDecorator('label')
        ->removeDecorator('HtmlTag')
        ->removeDecorator('Errors');

The form is using a ViewScript Decorator to handle the component objects.

The Controller that returns the json data looks like this.

public function unilistAction(){

    $db = Zend_Db::factory($this->config->database);

    $result = $db->fetchAll("SELECT * FROM universities ORDER BY name ASC");
    $data = new Zend_Dojo_Data('name', $result);
    $this->_helper->autoCompleteDojo($data);

    $db->closeConnection();
}

The resultset from the database is about 260 rows of data so not that large.

When displaying the form the other dojo components display and work as intended however this one just won't populate.

I've been staring at this for an age now and just can't see where I have gone wrong, please help me before I have a breakdown!

many thanks...