Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // controller
- // calls library function
- $about->contactDetails($this->getRequest()->getPost())
- // library
- // calls private function fo the form
- public function contactDetails()
- {
- ...
- $this->_getContactForm($mobile, $email);
- ...
- // library
- // function that calls the form
- protected function _getContactForm($mobile = false, $email = false)
- {
- require_once APPLICATION_PATH . '/forms/Contact.php';
- $form = new Form_Contact();
- $form->setAction('/about/contact');
- $form->contactDetails($mobile, $email);
- return $form;
- }
- // the form
- class Form_Contact extends Zend_Form
- {
- /*
- * display values for changing current vault password
- */
- public function contactDetails($msisdn = false, $email = false)
- {
- // set the method for the display form to POST
- $this->setMethod('post');
- $this->addElement('text', 'mobile', array(
- 'label' => 'Mobile Number:',
- 'required' => false,
- 'validators' => array(
- array('validator' => 'Digits'),
- array('stringLength', false, array(10, 20))
- )
- ));
- $this->addElement('text', 'email', array(
- 'label' => 'Email Address:',
- 'required' => false,
- 'validators' => array(
- array('validator' => 'EmailAddress')
- )
- ));
- // add the submit button
- $this->addElement('submit', 'submit', array(
- 'label' => 'Update',
- ));
- }
- }
Add Comment
Please, Sign In to add comment