Bootstrap响应式WYSWIG编辑器不会将输入数据发送到php [英] Bootstrap Responsive WYSWIG editor doesnt send input data to php

查看:101
本文介绍了Bootstrap响应式WYSWIG编辑器不会将输入数据发送到php的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 WYSWIG编辑器。该编辑器显示在引导程序的模式中。

I'm using this WYSWIG editor. This editor is displayed on a modal of bootstrap.

<form action="<?php echo base_url('dashboard/submit_post'); ?>" method="POST" role="form"  enctype="multipart/form-data">
<div class="form-group">
        <label for="post_title">Post Title</label>
        <input type="text" class="form-control" id="post_title" name="post_title" placeholder="Enter a title">
</div>
<div class="form-group">
        <label for="post_content">Post Content</label>
        <textarea name="post_content" id="post_content" cols="30" rows="3" class="form-control wyswig-editor"></textarea>
</div>

此函数Submit_post是这样的。

This function submit_post goes like this.

public function submit_post()
{
    $this->process_post();
}

private function process_post()
{
    $clean_post_title = $this->input->post('post_title');
    $clean_post_content = $this->input->post('post_content');

    $data = array(
            'post_title' => $clean_post_title,
            'post_content' => $clean_post_content
            );

    print_r($data);
}

其输出是显示帖子标题,但不显示帖子内容。它没有显示任何价值。我知道这一定是由于WYSWIG编辑器所致,所以我禁用了wyswig编辑器类,然后它可以正常工作。但是,我注意到一件事,当我禁用wyswig编辑器类并发布 Hello 作为post_content值时,它被显示,然后启用wyswig编辑器并将其值更改为 Hello2 ,输出仍显示为Hello。编辑器以某种方式创建了自己的文本区域,因此所显示的值属于原始文本区域。请帮助。

The output of this is that the post title gets displayed but the post content doesnt. It doesnt show any value. I knew this must be because of WYSWIG editor so I disabled the wyswig editor class and then it worked fine. However, one thing I noticed, when I disabled the wyswig editor class and posted "Hello" as the post_content value, it was displayed, then I enabled the wyswig editor and changed the value to "Hello2", the output was still displayed as Hello. Some way the editor created its own textarea and thus the value being displayed is of the original textarea. Please Help.

推荐答案

您使用的此编辑器不会自动将内容插入到text_field中,您必须自己通过javascript来完成此操作像这样:

This editor you are using does not automatically insert content to your text_field, you have to do it yourself via javascript like this:

$('#txtEditor').Editor("getText")

一般来说,这是一个糟糕的设计,我建议您使用其他类似这样的Bootstrap所见即所得编辑器,

Generally this is a bad design and I recommend that you use other bootstrap wysiwyg editors like these,

  • bootstrap-wysiwyg
  • bootstrap-wysihtml5
  • Summernote

我个人使用 summernote 在我的项目中。

I personally use summernote in my projects.

这篇关于Bootstrap响应式WYSWIG编辑器不会将输入数据发送到php的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆