简体   繁体   English

表单提交中没有任何内容

[英]Nothing happens on form submission

I applied tinyMCE to a text area in my sites admin area. 我将tinyMCE应用到我的站点管理区域中的文本区域。 Now there is a page "create category" and and page "edit category." 现在有一个页面“创建类别”和页面“编辑类别”。

In edit category, there is a drop-down of the categories, I select one and the text area for category description is filled in with AJAX and a tinyMCE function:_ 在编辑类别中,有一个下拉类别,我选择一个,类别描述的文本区域用AJAX和tinyMCE函数填充:_

tinyMCE.activeEditor.setContent(responce);

The category description is filled into the text area on which tinyMCE is applied. 类别描述填充到应用了tinyMCE的文本区域。 But when I click submit, NOTHING happens at all.Similarly, on the create category page, there is no drop down, but when you click submit, nothing happens at all. 但是当我点击提交时,一切都没有发生。同样,在创建类别页面上,没有下拉,但是当你点击提交时,根本没有任何事情发生。

This problem does not occur when tinyMCE is not applied. 未应用tinyMCE时不会发生此问题。 But on the edit category page, it was submitting but not filling in the text area with the category description, when instead of 但是在编辑类别页面上,它提交但不填写带有类别描述的文本区域,而不是

tinyMCE.activeEditor.setContent(responce);

I used 我用了

$("#lang_description").html(responce);

in the callback function for jQuery AJAX. 在jQuery AJAX的回调函数中。

So the main problem is that the forms are not being submitted and that was the story. 所以主要的问题是表格没有提交,这就是故事。

Someone suggested to use the tinyMCE function getContent before I post but I dont understand where and how I would do that. 有人建议在我发布之前使用tinyMCE函数getContent,但我不明白我会在哪里以及如何做到这一点。

I've faced a situation once like yours and what I did that was first i set in tinyMCE.init 我曾经遇到过像你这样的情况以及我做的事情,这首先是我在tinyMCE.init设置的

tinyMCE.init({
    mode : "exact", // Used exact
    elements : "page_content", // I gave the textarea id and name 'page_content'
    ...
});

Then I've wrote a function as follows 然后我写了一个函数如下

function get_page_content()
{
    var ed = tinyMCE.get('page_content');
    return ed.getContent();
}

Then inside my form submit event handler/function I just did 然后在我的表单提交事件处理程序/函数我刚刚做了

$('#page_content').val(get_page_content()); // I populated my textarea (id=page_content) before the form submission

I received the data using $page_content=$_POST['page_content'] in my php script 我在php脚本中使用$page_content=$_POST['page_content']收到数据

Update: May be you can use 更新:可能你可以使用

var ed=tinyMCE.activeEditor.getContent(); // when you didn't set the mode : "exact" in init function

Reference: getContent and setContent 参考: getContentsetContent

May be not a solution but If this helps then I'll be glad to know. 可能不是解决方案,但如果这有帮助那么我会很高兴知道。 Also notice Sparky672's comment. 另请注意Sparky672的评论。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM