Zend Frameworkを初めて使用しています。私は簡単なログインフォームを作ろうとしていますが、解決策がわからないという問題があります。問題は、フォーム要素が表示されていないことです。代わりに、フォームタグが作成されます(私はページソースコードを通してそれを見ることができます)。なぜフォームタグが作成されている間にフォーム要素が表示されないのですか?ここにコードがあります。でZend Formの問題:フォーム要素が表示されない
ファイルアプリケーション/フォーム/ Account.php
class Application_Form_Account extends Zend_Form
{
public function init()
{
// Initiate form
$this->setAction('account/login-exec');
$this->setMethod('post');
$this->setName('login-form');
// Add form elemen: username
$username = new Zend_Form_Element_Text('username');
$username -> setLabel('User Name');
// Add form element: Password
$password = new Zend_Form_Element_Password('password');
$password -> setLabel('Password');
// Add form elemet: Submit button
$submitButton = new Zend_Form_Element_Submit('submit');
$submitButton -> setLabel('Post Data');
}
}
ファイルアプリケーション/コントローラ/ AccountControllers.php
class AccountController extends Zend_Controller_Action
{
public function init()
{
}
public function indexAction()
{
// Show the login form in view
$form = new Application_Form_Account();
$this->view->pageHeading = "Please Login!!";
$this->view->form = $form;
}
}
ファイルアプリケーション/ビュー/ index.phtmlを
<h1><?php echo $this->pageHeading ?></h1>
<?php echo $this->form; ?>
ビュー、pageHeadingおよびformタグは表示されていますが、要素はありません。
ありがとうございました