2013-06-26 5 views
0

Ну, у меня есть этот код:

<?php 
if(isset($_POST['texto'])) { 
$texto = $_POST['texto']; 
echo "$texto"; 

?> 
<form action="/env_not.php" method="POST"> 
<textarea id="tinyeditor" name="texto" style="width: 700px; height: 800px"></textarea> 
<script> 
var editor = new TINY.editor.edit('editor', { 
    id: 'tinyeditor', 
    width: 700, 
    height: 800, 
    cssclass: 'tinyeditor', 
    controlclass: 'tinyeditor-control', 
    rowclass: 'tinyeditor-header', 
    dividerclass: 'tinyeditor-divider', 
    controls: ['bold', 'italic', 'underline', 'strikethrough', '|', 'subscript', 'superscript', '|', 
     'orderedlist', 'unorderedlist', '|', 'outdent', 'indent', '|', 'leftalign', 
     'centeralign', 'rightalign', 'blockjustify', '|', 'unformat', '|', 'undo', 'redo', 'n', 
     'font', 'size', 'style', '|', 'image', 'hr', 'link', 'unlink', '|', 'print'], 
    footer: true, 
    fonts: ['Verdana','Arial','Georgia','Trebuchet MS'], 
    xhtml: true, 
    cssfile: 'custom.css', 
    bodyid: 'editor', 
    footerclass: 'tinyeditor-footer', 
    toggle: {text: 'source', activetext: 'wysiwyg', cssclass: 'toggle'}, 
    resize: {cssclass: 'resize'} 
}); 
</script> <input type='submit' style='text-align: right' name='enviar' value='Enviar'> 
    </form> 

Когда я представить эту форму, мой $ _POST [ 'Texto'] возвращение пустой, как я могу передать значение в TinyEditor, к мой textarea.texto? Потому что мне нужно получить это значение с помощью PHP.

Спасибо!

ответ

0

Ну, прошло какое-то время, но я отвечу тем, что нашел. Может быть, это поможет кому-то в будущем.

У меня была такая же проблема, и тогда я обнаружил, что вам нужно щелкнуть «источник» (для просмотра html) и , затем submit. Если нет, это не спасет то, что вы написали. Не знаю, почему это происходит, я сам ищем помощь в этом вопросе.

0

Вам нужно добавить .. onsubmit = "editor.post()" .. в вашей форме, чтобы получить содержимое wysiwyg-редактора. Для wysiwyg-режима структура iframe построена динамически. Значение вашего объекта textarea не изменяется при работе в режиме wysiwyg. Только в исходном режиме. Надеюсь, это поможет.

0

TRY ЭТО РАБОТАЕТ ДЛЯ МЕНЯ:

<form action="/env_not.php" method="POST"> 
<textarea id="texto" name="texto" style="width: 700px; height: 800px"></textarea> 
<script> 
var texto = new TINY.editor.edit('texto', { 
    id: 'texto', 
    width: 700, 
    height: 800, 
    cssclass: 'tinyeditor', 
    controlclass: 'tinyeditor-control', 
    rowclass: 'tinyeditor-header', 
    dividerclass: 'tinyeditor-divider', 
    controls: ['bold', 'italic', 'underline', 'strikethrough', '|', 'subscript', 'superscript', '|', 
    'orderedlist', 'unorderedlist', '|', 'outdent', 'indent', '|', 'leftalign', 
    'centeralign', 'rightalign', 'blockjustify', '|', 'unformat', '|', 'undo', 'redo', 'n', 
    'font', 'size', 'style', '|', 'image', 'hr', 'link', 'unlink', '|', 'print'], 
    footer: true, 
    fonts: ['Verdana','Arial','Georgia','Trebuchet MS'], 
    xhtml: true, 
    cssfile: 'custom.css', 
    bodyid: 'editor', 
    footerclass: 'tinyeditor-footer', 
    toggle: {text: 'source', activetext: 'wysiwyg', cssclass: 'toggle'}, 
    resize: {cssclass: 'resize'} 
}); 
$('#enviar').click(function() { 
    texto.post(); 
}); 
</script> 
<input type='submit' style='text-align: right' name='enviar' id='enviar' value='Enviar'> 
</form>