public function getprovAction() { $provinces = new PAP_Model_ProvinceMapper(); $this->_helper->layout()->disableLayout(); $this->_helper->viewRenderer->setNoRender(); //if ($this->getRequest()->isXmlHttpRequest()) { $provincesData = $provinces->findForSelect(); $this->_helper->json($provincesData); //echo '{"items":'. $this->_helper->json($provincesData) .'}'; //} }
private function loadProvinces(Zend_Form_Element_Select $combo, $province_id = 0) { $provinceMapper = new PAP_Model_ProvinceMapper(); foreach ($provinceMapper->findForSelect() as $p) { $combo->addMultiOption($p['province_id'], $p['name']); } if ($province_id == 0) { $this->view->form->setDefault('province', '1'); } else { $this->view->form->setDefault('province', $province_id); } }