在 Zend_Form_Element_Text 元素中禁用转义字符串

发布于 2024-12-18 23:04:48 字数 558 浏览 3 评论 0原文

我有以下代码:

// agregamos el campo de fecha de nacimiento
$this->direccion = new Zend_Form_Element_Text('direccion');
$this->direccion->setLabel('Dirección:');
$this->direccion->setAttrib('escape', false);
$this->direccion->getDecorator('Label')->setOption('escape',false);
$this->direccion->setRequired(true);
$this->addElement($this->direccion);

出于某种原因,在尝试将 setValue() 设置为“Larrañaga”时,内容被转义,并且输入值中没有显示任何内容。请注意,setAttrib('escape', false) 应用于元素,如几篇文章中所建议的。

有什么想法吗?谢谢!

I have the following piece of code:

// agregamos el campo de fecha de nacimiento
$this->direccion = new Zend_Form_Element_Text('direccion');
$this->direccion->setLabel('Dirección:');
$this->direccion->setAttrib('escape', false);
$this->direccion->getDecorator('Label')->setOption('escape',false);
$this->direccion->setRequired(true);
$this->addElement($this->direccion);

For some reason, while trying to setValue() to "Larrañaga", the content is escaped, and nothing is shown in the input's value. Note that setAttrib('escape', false) is applied to the element, as suggested in several posts.

Any idea? Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

说不完的你爱 2024-12-25 23:04:48

将此行添加到您的 init() 方法中:

$this->getView()->setEscape('stripslashes');

Add this line into your init() method:

$this->getView()->setEscape('stripslashes');
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文