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 不包含更新的值


基础教程推荐
- HTTP 与 FTP 上传 2021-01-01
- 在 CakePHP 2.0 中使用 Html Helper 时未定义的变量 2021-01-01
- phpmyadmin 错误“#1062 - 密钥 1 的重复条目‘1’" 2022-01-01
- PHP 守护进程/worker 环境 2022-01-01
- 如何在 Symfony 和 Doctrine 中实现多对多和一对多? 2022-01-01
- 找不到类“AppHttpControllersDB",我也无法使用新模型 2022-01-01
- Doctrine 2 - 在多对多关系中记录更改 2022-01-01
- 在 yii2 中迁移时出现异常“找不到驱动程序" 2022-01-01
- 使用 PDO 转义列名 2021-01-01
- 如何在 XAMPP 上启用 mysqli? 2021-01-01