Guest User

Untitled

a guest
May 27th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. // controller
  2. // calls library function
  3. $about->contactDetails($this->getRequest()->getPost())
  4.  
  5. // library
  6. // calls private function fo the form
  7. public function contactDetails()
  8. {
  9. ...
  10. $this->_getContactForm($mobile, $email);
  11. ...
  12.  
  13. // library
  14. // function that calls the form
  15. protected function _getContactForm($mobile = false, $email = false)
  16. {
  17. require_once APPLICATION_PATH . '/forms/Contact.php';
  18. $form = new Form_Contact();
  19. $form->setAction('/about/contact');
  20. $form->contactDetails($mobile, $email);
  21.  
  22. return $form;
  23. }
  24.  
  25. // the form
  26. class Form_Contact extends Zend_Form
  27. {
  28. /*
  29. * display values for changing current vault password
  30. */
  31. public function contactDetails($msisdn = false, $email = false)
  32. {
  33. // set the method for the display form to POST
  34. $this->setMethod('post');
  35.  
  36. $this->addElement('text', 'mobile', array(
  37. 'label' => 'Mobile Number:',
  38. 'required' => false,
  39. 'validators' => array(
  40. array('validator' => 'Digits'),
  41. array('stringLength', false, array(10, 20))
  42. )
  43. ));
  44.  
  45. $this->addElement('text', 'email', array(
  46. 'label' => 'Email Address:',
  47. 'required' => false,
  48. 'validators' => array(
  49. array('validator' => 'EmailAddress')
  50. )
  51. ));
  52.  
  53. // add the submit button
  54. $this->addElement('submit', 'submit', array(
  55. 'label' => 'Update',
  56. ));
  57. }
  58.  
  59.  
  60. }
Add Comment
Please, Sign In to add comment