【问题标题】:Inserting HTML Form using CKeditor does not work使用 CKeditor 插入 HTML 表单不起作用
【发布时间】:2012-11-10 05:58:47
【问题描述】:

我在使用 Ckeditor 时遇到了一个大问题。 我希望我的客户可以通过个性化页面添加贝宝捐赠按钮。 当我的客户想要添加自定义页面时,他们使用 ckeditor。

要添加贝宝按钮,他们只需使用源模式复制/粘贴以下代码:

<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_donations">
<input type="hidden" name="business" value="try@try.com">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="item_name" value="Try">
<input type="hidden" name="no_note" value="0">
<input type="hidden" name="currency_code" value="EUR">
<input type="hidden" name="bn" value="PP-DonationsBF:btn_donateCC_LG.gif:NonHostedGuest">
<input type="image" src="https://www.paypalobjects.com/fr_XC/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - la solution de paiement en ligne la plus simple et la plus sécurisée !">
<img alt="" border="0" src="https://www.paypalobjects.com/fr_XC/i/scr/pixel.gif" width="1" height="1">
</form>

然而,当他们保存时,不知何故,html被这个修改了:

<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
    &nbsp;</form>

我不知道如何避免这种情况。 我认为这是 CKeditor 配置中的一个选项,它正在替换一些 html 代码,但我不确定。

非常感谢您对未来的建议,

安塞尔

【问题讨论】:

  • 我刚刚尝试将此 HTML 粘贴到 ckeditor.com/demo 的编辑器中,并通过 getData() 方法获取数据。我没有遇到任何问题。您确定您使用的是最新的 CKEditor 并且没有一些非默认设置吗?

标签: html forms paypal ckeditor


【解决方案1】:

这里发生的情况是您在编辑器中有一个form,内容中有一个form。 HTML 中不能有嵌套表单。您可能必须想出一些标记化的标记替换机制才能使其正常工作。

我相信 ckeditor 有一个表单插件可能会有所帮助。

【讨论】:

  • 不,如果他正确地对页面进行编码,这不是问题。在 CKEditor 3.x 中,他只需对 textarea 的内容进行 HTMLEncode,这样的问题就不会发生。
  • CKEditor 的内容没有嵌套在 form 中——它在 iframe 中,所以它是独立的范围。
【解决方案2】:

检查ckeditor下方的“文本格式”应该是“完整的HTML”

【讨论】:

    猜你喜欢
    • 2018-04-20
    • 1970-01-01
    • 2011-01-03
    • 1970-01-01
    • 2023-03-07
    • 2022-01-05
    • 2016-08-04
    • 2021-03-15
    • 1970-01-01
    相关资源
    最近更新 更多