Advertisement
Guest User

Untitled

a guest
Dec 3rd, 2012
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. public function testAction() {
  2. if($this->getParam('flush', 'false') === 'true' || !isset($_SESSION['form'])) {
  3. $_SESSION['form'] = new Zend_Form();
  4.  
  5. $platform = new Zend_Form_SubForm();
  6. $_SESSION['form']->addSubForm($platform, 'platform');
  7.  
  8. $appli = new Zend_Form_SubForm();
  9. $_SESSION['form']->addSubForm($appli, 'appli');
  10.  
  11. $step = new Zend_Form_Element_Text('__step');
  12. $step->setValue(1);
  13. $step->setLabel('step');
  14. $_SESSION['form']->addElement($step);
  15.  
  16. $pfname = new Zend_Form_Element_Text('name');
  17. $pfname->setValue('platform name');
  18. $pfname->setLabel('platform name');
  19. $platform->addElement($pfname);
  20.  
  21. $applinet = new Zend_Form_SubForm();
  22. $appli->addSubForm($applinet, 'net');
  23.  
  24. $applinetaddr = new Zend_Form_Element_Text('addr');
  25. $applinetaddr->setLabel('Appli network address');
  26. $applinetaddr->setValue('localhost');
  27. $applinet->addElement($applinetaddr);
  28.  
  29. }
  30.  
  31. $this->view->form = $_SESSION['form'];
  32.  
  33. // Process request
  34. if($this->getRequest()->isPost()) {
  35. if($this->view->form->isValid($_POST)) {
  36. $this->view->data = $this->view->form->getValues();
  37. }
  38. }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement