我有一页有两种形式,一种用于登录,另一种用于忘记密码,
<?php echo $this->layout()->user_login = $this->action('login','user',null); ?>
<?php echo $this->layout()->user_forgot = $this->action('forgot','user',null); ?>
并且表单在操作中,每个表单都有自己的视图,我在忘记操作中有一个哈希验证器,但是当我提交忘记的表单时,我收到错误“两个给定的令牌不匹配”,我认为在布局期间过程中,表单将被实例化并且哈希ID会改变:(我不知道如何修复它......
这是被遗忘的形式
<?php
class listab_Form_Forgot extends Zend_Form
{
public function init()
{
$this->addPrefixPath("listab_Model",'listab/Model/','decorator');
// initialize form
$this->setAction('/user/forgot')
->setMethod('post');
// create text input for name
$user = new Zend_Form_Element_Text('name');
$user->setLabel('username or email')
->setOptions(array('size' => '30'))
->addFilter('HtmlEntities')
->addFilter('StringTrim')
->setDecorators(array('ViewHelper','Label'))
->setRequired(true);
$submit = new Zend_Form_Element_Submit('subfg');
$submit->setLabel('help me find my password')
->setOrder(100)
->setOptions(array('class' => 'submit'))
->setAttrib('class', 'gbox ozvbut')
->setDecorators(array('ViewHelper');
$hash = new Zend_Form_Element_Hash('hashs');
$hash->setSalt('wannaknowthisha?') ;
$this->addElement($user)
->addElement($hash)
->addElement($submit) ;
}
}