Does anybody know how to reset the content of CKeditor texarea? The reset button works fine for a normal textarea, but when I add class="ckeditor" then edit the text and click reset the content stays as per edited version (ie doesn't change back). The content is dynamically generated in PHP from a mysql database using an object for page functions. The code I have is as follows:
<form action="thispage.php" method="post">
<label>Text:</label>
<textarea class="ckeditor" cols="30" id="body" name="body" rows="10"><?php echo $page->body; ?></textarea>
<input type="submit" name="submit" value="Update Text" />
<input type="reset" name="reset" value="Reset" id="reset" />
</form>
I have also tried replacing the reset button with the following:
<input type="button" value="reset" onclick="this.form.elements['body'].value='<?php echo $page->body; ?>'"/>
Please let me know how I can create a button to reset the content in the CKeditor textarea.
Thanks!
<form action="thispage.php" method="post">
<label>Text:</label>
<textarea class="ckeditor" cols="30" id="body" name="body" rows="10"><?php echo $page->body; ?></textarea>
<input type="submit" name="submit" value="Update Text" />
<input type="reset" name="reset" value="Reset" id="reset" />
</form>
I have also tried replacing the reset button with the following:
<input type="button" value="reset" onclick="this.form.elements['body'].value='<?php echo $page->body; ?>'"/>
Please let me know how I can create a button to reset the content in the CKeditor textarea.
Thanks!
Re: Resetting textarea PHP content
It seems like if I could force the editor to refresh from the underlying textarea, or if I could remove the existing editor and create a new one (thus forcing it to reload from the underlying form element), I would be able to work around the problem. I haven't quite gotten this approach to work yet, though I might be doing something slightly wrong.
Is there a better way to accomplish this?
Thanks.
Re: Resetting textarea PHP content
I haven't found a solution, but since posting I noticed the undo button, which is ok for most situations, unless you've made a lot of changes then it becomes tedious. Please let me know if you find a solution...
Thanks
Re: Resetting textarea PHP content
It seems that a ticket is opened about this issue :
http://dev.fckeditor.net/ticket/5346
My workaround is to use a button type button instead of a reset type one to reload the page (with the previous values) :
Re: Resetting textarea PHP content
Here's how I solved this :
Using jquery, I just emptied the body content of the iframe of the ckeditor
Re: Resetting textarea PHP content
This can be bound to the OnReset event for the form.
Re: Resetting textarea PHP content
utpol