将 htmlEntities 解码回填充 Zend Form
我用 htmlEntities 解码我的 zend-form。这很好用,但是当我将表单重新填充回用户时,我想对输入进行解码。有没有办法逆转 Zend 中的 setElementFilter ?
示例:
填写输入字段
You & me
用户使用数据库中放置的数据
You & me
:我从数据库取回数据并用它填充输入字段:
You & me
我只想找回我的&符号(在本例中)并看到这个:
You & me
提前致谢,
I decode my zend-form with htmlEntities. This works great, but I would like to decode the input back when I repopulate the form back to the user. Is there a way to reverse the setElementFilter in Zend?
Example:
User fills in input field with
You & me
Data placed in the database:
You & me
I get the data back from the database and populate the input field with it:
You & me
I just want my ampersand (in this case) back and see this:
You & me
Thanks in advance,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
否。您应该使用 html_entity_decode 在填充表单之前
No. You should filter your data with html_entity_decode before populating your form
如果表单无效或我想编辑一些数据
,或者想用自定义数据填充表单
,我通常会重新填充表单,zend form 将负责过滤、验证和填充表单
http://framework.zend.com/manual/en/zend.form .forms.html
希望有帮助
I usually repopulate my form if it was invalid or i wanted to edit some data
or if wanted to fill the form with custom data
and zend form will take care of filtering , validating and populating the form back
http://framework.zend.com/manual/en/zend.form.forms.html
hope that would help