Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [ZendFramework] Problem z form
dzesi
post
Post #1





Grupa: Zarejestrowani
Postów: 235
Pomógł: 0
Dołączył: 3.05.2006

Ostrzeżenie: (0%)
-----


Witam od niedawna poznaje mvc i poznaje zend framework od wczoraj smile.gifi mam problem z zend_form

Mam problem z stworzeniem formularza w zend czytam dokumentacje ale nie wszystko rozumie smile.gif

kontroler

  1. <?php
  2.  
  3. class RejController extends Zend_Controller_Action
  4. {
  5.  
  6. public function getForm()
  7. {
  8.     return $form;
  9. }
  10.  
  11. public function indexAction()
  12. {
  13.    
  14.    
  15.      require_once APPLICATION_PATH . '/forms/Rej.php';
  16.    
  17.    
  18. }
  19.  
  20. }
  21. ?>



widok
  1. <h1 align="center">
  2. Rejestracja
  3.  
  4. <?= $this->form ?>
  5. </h1>


/forms/Rej.php


  1. <?php
  2. $form = new Zend_Form();
  3.  
  4. $form->setAction('rej/wys');
  5. $form->setMethod('post');
  6.  
  7. //tworzenie nowego pola username
  8. $username=$form->createElement('text','username');
  9.  
  10.  
  11. // Tworzenie nowego pola password
  12.  
  13. $password=$form->createElement('password','password');
  14.  
  15. $form->addElement($username)->addElement($password)->addElement('submit','login');
  16. ?>


Bardzo bym prosił o pokazanie co robię zle ze formularz mi się nie pokazuje smile.gif
Go to the top of the page
+Quote Post
wolditm
post
Post #2





Grupa: Zarejestrowani
Postów: 31
Pomógł: 2
Dołączył: 20.07.2005

Ostrzeżenie: (0%)
-----


  1. <?php
  2. public function indexAction()
  3. {
  4.    require_once APPLICATION_PATH . '/forms/Rej.php';
  5.  
  6.     $this->view->form = $form;
  7. }
  8. ?>


--------------------
Wspomnienia
Go to the top of the page
+Quote Post
batman
post
Post #3





Grupa: Moderatorzy
Postów: 2 921
Pomógł: 269
Dołączył: 11.08.2005
Skąd: 127.0.0.1




Przykład formularza. W tym artykule masz wszystko wyjaśnione jak na dłoni.


--------------------
I would love to change the world, but they won't give me the source code.
My software never has bugs. It just develops random features.
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 21.08.2025 - 21:52