在 Zend Form 里面写超链接? [英] Write hyperlink inside the Zend Form?
本文介绍了在 Zend Form 里面写超链接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在我的项目中使用 Zend-Framework.我使用 Zend 表单制作了一个登录表单,其中包含带有提交按钮的用户 ID 和密码字段.登录表单中一切正常.
I am using Zend-Framework in my project. I made a login form using the Zend Form that contains the User Id and Passwords fields with a submit button. Everything is working fine in the login form.
如何在登录表单中添加两个超链接,一个用于注册,另一个用于忘记密码?
How do I add two hyperlinks inside the login form that is one for the Sign-Up and other for the Forget Password?
推荐答案
我之前也遇到过同样的问题,通过创建一个自定义的 Zend_Form_Element_Html 解决了,如下:
I've faced the same problem before, and solved it by creating a custom Zend_Form_Element_Html, as follows:
class Zend_Form_Element_Html extends Zend_Form_Element_Xhtml {
/**
* Default form view helper to use for rendering
* @var string
*/
public $helper = 'formNote';
public function isValid($value, $context = null) {
return true;
}
}
因此,在您的表单中,您只需执行以下操作:
So, in your form you just have to do the following:
$tag = new Zend_Form_Element_Html('forgetPassword');
$tag->setValue('<a href="/forgotten-pwd">Forgotten your password?</a>');
$this->addElement($tag);
希望这会有所帮助!
这篇关于在 Zend Form 里面写超链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文