Zend 1.11.9 表单装饰器/验证码
在新的 Zend Framework 版本 1.11.9 中,如果我想在表单中使用验证码,这可以是一个简单的Figlet,验证码不会显示在渲染的表单中。 有没有人遇到过这个问题,我一直在搜索并将其与以前的版本(Zend/Form/Element/Captcha.php)进行比较,我注意到我必须为此元素指定 Captcha 装饰器。 有没有更好的解决方案,这个装饰器不应该默认使用吗?
//Add a captcha
$this->addElement('captcha', 'captcha', array(
'label' => 'Please enter the 5 letters displayed below:',
'required' => true,
'captcha' => array(
'captcha' => 'Figlet',
'wordLen' => 5,
'timeout' => 300
)
));
这是代码,如果我在 Zend 1.11.9 中使用它,则不会显示 capctha, 我要做的就是将“装饰器”添加到 capctha 的选项中,并且必须在那里指定所有装饰器。
//Add a captcha
$this->addElement('captcha', 'captcha', array(
'label' => 'Please enter the 5 letters displayed below:',
'required' => true,
'captcha' => array(
'captcha' => 'Figlet',
'wordLen' => 5,
'timeout' => 300
),
'decorators' => array('Captcha', 'Errors', 'Labels', etc)
));
In the new Zend Framework version 1.11.9 if I want to use a captcha in my form this can be a simple Figlet, the captcha is not shown in the rendered form.
Has anyone encountered this issue, I've been searching and comparing it with the previous release, (Zend/Form/Element/Captcha.php) and what i noticed is that I must specify the Captcha decorator for this element.
Is there a better solution, shouldn't this decorator been used by default?
//Add a captcha
$this->addElement('captcha', 'captcha', array(
'label' => 'Please enter the 5 letters displayed below:',
'required' => true,
'captcha' => array(
'captcha' => 'Figlet',
'wordLen' => 5,
'timeout' => 300
)
));
This is the code, if I use this in Zend 1.11.9 the capctha is not displayed,
What I had to do was to add 'decorators' to the options of teh capctha and had to specify there all the decorators.
//Add a captcha
$this->addElement('captcha', 'captcha', array(
'label' => 'Please enter the 5 letters displayed below:',
'required' => true,
'captcha' => array(
'captcha' => 'Figlet',
'wordLen' => 5,
'timeout' => 300
),
'decorators' => array('Captcha', 'Errors', 'Labels', etc)
));
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我遇到了同样的问题。在 Zend Framework 问题跟踪器上发布了错误报告: http://framework.zend.com/issues /browse/ZF-11609
希望尽快得到解决。我检查了 1.11.9 更改日志:recaptcha 组件发生了更改。也许这就是原因...
I've encountered the same problem. Posted a bug report on Zend Framework issue tracker: http://framework.zend.com/issues/browse/ZF-11609
Hope it will get resolved soon. I've checked the 1.11.9 changelog: there was a change at the recaptcha component. Maybe that's the reason...
我可以确认这一点。为了向您展示一些代码,在 ZF 1.11.8 中,这是开箱即用的:
在 1.11.9 中,它不会渲染图像标签。此行为不限于线程开启者所述的 Zend_Captcha_Image。
I can confirm this. To show you some code, in ZF 1.11.8 this works out of the box:
In 1.11.9 it doesn't render the image tag. This behavoir is not limited to Zend_Captcha_Image as stated by the thread opener.
我使用的是最新版本的ZF
并不
显示任何内容 =-(
这是页面上的源代码:
I'm using the latest version of ZF
and
Show nothing =-(
This is the source on the page: