PDA

View Full Version : Resolved tinyMCE - Keep content in textarea



Schmoopy
09-29-2009, 02:21 PM
Hey, I thought this would be simple but at the moment I just can't figure out how to keep the content from disappearing after submitting a form.

Here is the code I have:



<script type="text/javascript" src="../js/tiny_mce.js"></script>
<script type="text/javascript">
tinyMCE.init({
mode : "textareas",
elements : 'post-content',
theme : "advanced",

// Drop lists for link/image/media/template dialogs
theme_advanced_buttons3_add : "preview",
template_external_list_url : "../js/template_list.js",
external_link_list_url : "../js/link_list.js",
external_image_list_url : "../js/image_list.js",
media_external_list_url : "../js/media_list.js"
});
</script>
<textarea rows="20" style="width:100%" id="post-content" name="post-content"></textarea><br />
<input type="submit" id="preview_post" name="preview_post" value="Preview"/><input type="submit" id="submit_addpost" name="submit_addpost" value="Add Post"/>


So, when the "Preview" button is clicked, I want the text entered to stay in there. I tried using php in between the textarea like this:


<textarea rows="20" style="width:100%" id="post-content" name="post-content"><?php if(isset($_POST['post-content'])) echo $_POST['content']?></textarea>

But it's not actually there, it's embedded within the javascript, any ideas?

I've tried the "preview" plugin, but that's not really what I want.

Fixed, seems to be working now, maybe I'm blind >.<