CKEditor + Yii loaded with AJAX : $_POST doesn#39;t contain the updated value(用 AJAX 加载的 CKEditor + Yii:$_POST 不包含更新的值)
问题描述
简而言之:
我正在使用 Yii 框架
i'm using Yii Framework
我的页面上有一个 Ckeditor 窗口(php/yii 框架 - 工作正常)
i have a one Ckeditor window on my page ( php/ yii framework - works fine)
当我点击一个按钮时,一个新的 CKeditor 窗口正在生成并通过 AJAX 调用显示
when i hit a button, a new CKeditor window is being generated and shown through AJAX call
问题:这个新的 CKEditor 窗口正确显示了存储在数据库中的文本但是:当我点击保存"(与表单的其余部分一起生成的 ajax 按钮)时,这个新的 CKEditor 窗口中的值将不保存:CKeditor 发回它从数据库中获得的旧值.
THE PROBLEM: this new CKEditor window correctly displays the text stored in the database BUT : when i hit "Save" (an ajax button generated together with the rest of the form) the values from this new CKeditor window will not save : CKeditor sends back the old values that it got from the database.
当我移除 Ckeditor 并保留普通的
When i remove the Ckeditor and leave the plain <textarea> : everything is ok so i know that the controller is fine.
请问,有人经历过这样的事情吗?
Please, anybody went through something like this?
推荐答案
听起来像是典型的 AJAX 后 JS 绑定问题.:) 解决方法有几种可能,具体取决于发生了什么问题.
Sounds like a typical post-AJAX JS binding issue. :) There are a few possibilities for how to fix it, depending on what is going wrong.
Yii 论坛上的这篇帖子对你来说应该是钱,这是我得到大部分建议的地方:http://www.yiiframework.com/forum/index.php?/topic/9341-ckeditor-widget-in-a-cactiveform/
This post in the Yii forum should be money for you, it's where I got most of these suggestions: http://www.yiiframework.com/forum/index.php?/topic/9341-ckeditor-widget-in-a-cactiveform/
- 使用已经解决了这个问题的小部件 Yii 扩展(NHCKEditor?)
- 向提交按钮添加 onClick 回调,该回调将 CKEditor 内容保存到隐藏的
'textarea' ('onclick'=>'CKEDITOR.instances.TEXTAREA_ID.updateElement()',
莉> - 使用jQuery从CKEditor iFrame中获取数据 在任何地方使用....AJAX 验证等
- Use a widgetized Yii extension which has already solved this problem (NHCKEditor?)
- Add an onClick callback to the submit button which saves the CKEditor content to the hidden
'textarea' ('onclick'=>'CKEDITOR.instances.TEXTAREA_ID.updateElement()',
- Use jQuery to get the data from the CKEditor iFrame to use... wherever. AJAX validation, etc.
祝你好运!
这篇关于用 AJAX 加载的 CKEditor + Yii:$_POST 不包含更新的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:用 AJAX 加载的 CKEditor + Yii:$_POST 不包含更新的值


基础教程推荐
- 如何在数学上评估像“2-1"这样的字符串?产生“1"? 2022-01-01
- php中的PDF导出 2022-01-01
- 使用 scandir() 在目录中查找文件夹 (PHP) 2022-01-01
- 将变量从树枝传递给 js 2022-01-01
- php 7.4 在写入变量中的 Twig 问题 2022-01-01
- Web 服务器如何处理请求? 2021-01-01
- Yii2 - 在运行时设置邮件传输参数 2022-01-01
- php中的foreach复选框POST 2021-01-01
- 主题化 Drupal 7 的 Ubercart “/cart"页 2021-01-01
- PHPUnit 的 Selenium 2 文档到底在哪里? 2022-01-01