Hi all.
I have a number of FilteringSelect elements within my Zend Framework
application that are working fine but they are based on simple queries.
I now need to create a FilteringSelect that will allow me to select the id
of one table while displaying the text of field in a related table, i.e. I
have two tables groomservices and groomprocedures which are related (i.e.
groomprocedures.groomProceduresID has many groomservices.procedure).
The form I'm trying to create is for an appointments table which has many
groomservices.groomServicesID values. I want the user to be able to see the
name of the procedure while saving the value of the
groomservices.groomServicesID using the FilteringSelect.
So far I've not been able to do this in that my FilteringSelect displays
nothing, I'm sure this can be done just that the fault is with my
inexperience with Zend,Doctrine and Dojo
I'm not sure if my problem is with my autocomplete action of my controller
or with the FilteringSelect element.
Can anyone spot where I've gone wrong in the code sections below.
My autocomplete action within my controller
public function gserviceAction()
{
// disable layout and view rendering
$this->_helper->layout->disableLayout();
$this->getHelper('viewRenderer')->setNoRender(true);
// get a list of all grooming services IDs and related procedures
$qry= Doctrine_Query::create()
->select('g.groomServicesID,p.groomProcedure')
->from('PetManager_Model_Groomservices g')
->leftJoin('g.PetManager_Model_Groomprocedures p');
$result=$qry->fetchArray();
//generate and return JSON string
$data = new Zend_Dojo_Data('g.groomServicesID',$result);
echo $data->toJson();
}
My FilteringSelect element code
// Create a autocomplete select input for the service
$gservice = new
Zend_Dojo_Form_Element_FilteringSelect('gapmtService');
$gservice->setLabel('Proceedure');
$gservice->setOptions(array(
'autocomplete' => true,
'storeID' => 'gserviceStore',
'storeType' => 'dojo.data.ItemFileReadStore',
'storeParams' => array('url' =>
"/groomappointments/appointment/gservice"),
'dijitParams' => array('searchAttr' => 'groomProcedure')))
->setRequired(true)
->addValidator('NotEmpty', true)
->addFilter('HTMLEntities')
->addFilter('StringToLower')
->addFilter('StringTrim');
Many thanks in advance,
I.S.
p.s. I'm dying with the flu, I've checked the message for typos etc but if
there's any sorry, if clarification is required please let me know.
--
View this message in context:
http://zend-framework-community.634137.n4.nabble.com/Help-needed-creating-filteringselect-from-joined-tables-tp3470508p3470508.html
Sent from the Zend Framework mailing list archive at Nabble.com.
--
List: [email protected]
Info: http://framework.zend.com/archives
Unsubscribe: [email protected]