自定义模块/组件无法保存 HTML
我的自定义组件和模块有问题。在 XML 表单中,我创建了此字段
<field name="bio" type="editor" height="250" label="Biography"
description="Intro To The Artist" buttons="true" />
现在数据可以从数据库正确加载。 我在视图中使用此代码输出 Wyswig 编辑器和正确的 html $this->form->getInput('bio');
但是当我保存时,表格。一切都按预期保存,除了所有 html 都被删除。
我不知道这种情况通常发生在哪里,即使我将 XML 添加到模块中(该模块通常负责所有渲染)。一切都显示正常,但 HTML 被删除了。
Joomla wiki 似乎不完整,我找不到有关如何解决此问题的有用信息。
谢谢
I have a problem, with my custom components and modules. In the form XML i created this field
<field name="bio" type="editor" height="250" label="Biography"
description="Intro To The Artist" buttons="true" />
Now the data loads correctly from the DB.
I output the Wyswig editor and the correct html with this code in the view $this->form->getInput('bio');
However when I save, the form. everything is saved as expected except, all html is stripped.
I don't know where this usually happens, even when I add the XML to a module (the module takes care of all the rendering usually). All displays fine, but the HTML get's stripped.
The Joomla wiki seems incomplete on and I can't find helpful information on how to solve this issue.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在google group 上找到了解决方案。我需要将
filter="safehtml"
添加到我相信这是 Joomla 1.6 特定的字段,另一个设置可能是
filter="raw"
The solution was found on google groups. I needed to add
filter="safehtml"
to the fieldI believe this is Joomla 1.6 specific, also another setting might be
filter="raw"
您必须添加 JREQUEST_ALLOWRAW 参数才能保留 HTML。
http://docs.joomla.org/How_to_use_the_editor_in_a_component
You have to add the JREQUEST_ALLOWRAW parameter in order to preserve the HTML.
http://docs.joomla.org/How_to_use_the_editor_in_a_component
要获取 HTML 表单发布数据,您需要通过以下方式获取此数据
,并且需要为视图(tmpl 文件)添加 JavaScript
To get HTML form post data you need to get this data in following way
And need to add a javascript for the view(tmpl file)