示例#1
0
 public function createAction()
 {
     // cria form
     $form = new C3op_Form_ContactCreate();
     $this->view->form = $form;
     if ($this->getRequest()->isPost()) {
         $postData = $this->getRequest()->getPost();
         if ($form->isValid($postData)) {
             $id = $form->process($postData);
             $this->_helper->getHelper('FlashMessenger')->addMessage('The record was successfully updated.');
             $this->_redirect('/register/contact/success-create/?id=' . $id);
         } else {
             throw new C3op_Register_ContactException("Invalid data");
         }
     }
 }
示例#2
0
 public function init()
 {
     parent::init();
     // initialize form
     $this->setName('editContactForm')->setAction('/register/contact/edit')->setMethod('post');
     $id = new Zend_Form_Element_Hidden('id');
     $id->addValidator('Int')->addFilter('StringTrim');
     $this->addElement($id);
     $this->removeElement('areaCode');
     $this->removeElement('localNumber');
 }