YUI2富文本编辑器,没有返回到PHP的变量
我正在使用雅虎的YUI2富文本编辑器,它取代了标准文本区域。如果不添加RTE,文本区域字段会将字段内容正确返回到我的PHP代码中。但是,当我使用RTE代码时,jQuery会“吸收”var,并且不会在提交时将其返回到文本区域。因此,var(sectiontext1)返回为空。以下是文本区域的js:YUI2富文本编辑器,没有返回到PHP的变量,php,jquery,yui,Php,Jquery,Yui,我正在使用雅虎的YUI2富文本编辑器,它取代了标准文本区域。如果不添加RTE,文本区域字段会将字段内容正确返回到我的PHP代码中。但是,当我使用RTE代码时,jQuery会“吸收”var,并且不会在提交时将其返回到文本区域。因此,var(sectiontext1)返回为空。以下是文本区域的js: var myEditor1 = new YAHOO.widget.Editor('sectiontext1', { height: '100px', width: '870px', do
var myEditor1 = new YAHOO.widget.Editor('sectiontext1', {
height: '100px',
width: '870px',
dompath: false,
animate: true,
toolbar: {
titlebar: 'Section Text 1',
buttons: [
{ group: 'textstyle', label: '',
buttons: [
{ type: 'push', label: 'Bold', value: 'bold' },
{ type: 'push', label: 'Italic', value: 'italic' },
{ type: 'push', label: 'Underline', value: 'underline' },
{ type: 'separator' },
{ type: 'color', label: 'Font Color', value: 'forecolor', disabled: true },
{ type: 'separator' },
{ type: 'push', label: 'Create an Unordered List', value: 'insertunorderedlist' },
{ type: 'push', label: 'Create an Ordered List', value: 'insertorderedlist' },
{ type: 'separator' },
{ type: 'push', label: 'Indent', value: 'indent', disabled: true },
{ type: 'push', label: 'Outdent', value: 'outdent', disabled: true },
{ type: 'separator' },
{ type: 'push', label: 'HTML Link CTRL + SHIFT + L', value: 'createlink', disabled: true },
{ type: 'separator' },
{ type: 'push', label: 'Remove Formatting', value: 'removeformat', disabled: true }
]
}
]
}
});
myEditor1.render();
我想我可以在上面的内容之后再加上这个,它会起作用,但它没有:
$('#submit').click(function() {
myEditor1.saveHTML();
});
如何让代码返回var,以便在PHP中使用它
谢谢 什么意思不起作用? 您可能希望实际将结果存储在一个变量中,并查看是否获得了html 如果该变量中确实包含html,那么您可以以任何方式使用它,包括通过ajax请求将其发送到php
var html = myEditor1.saveHTML();
alert('editor html: ' + html);
我的意思是,如果我不使用富文本编辑器,我会在PHP中获取变量的内容。如果我使用rte,它会以某种方式“保存”var,而不会返回浏览器,因此var显示为空。我会试试你在这里列出的,看看会发生什么。不起作用。包含变量的东西。我将考虑其他选择,比如使用TinyMCEOh不,请不要放弃。YUI RTE比TinyMCE好多了。我已经用了好几年了,修改了它,添加了新的按钮,它总是能工作。