• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 512
  • Last Modified:

CKeditor and auto save with Coldfusion

Im trying to use CKeditor to make changes on a page, at the same time I would like it to autosave the information in to the database. I found this code online (uses FDKeditor) but when I add the Ckeditor, it does not replace the old FDKeditor. But what I would really like is to use the CKeditor inline feature if that is possible. Is there something Im missing with this code or Is there a code already out there that has the CKeditor inline feature?

<html>
	<head>
       
		<script type="text/javascript">
			function autoSave(){
				ColdFusion.Ajax.submitForm("auto", "autoSaveAction.cfm", setSaveTime);
				autoSaveEvery(10000);
			}
			function autoSaveEvery(ms) {
				var timeout=setTimeout("autoSave()",ms);
			}
			function setSaveTime(res) {
				if (res) {
					document.getElementById('messageArea').innerHTML = 'Autosaved at ' + nowFormated();
				}
			}
			function nowFormated(){
				var now = new Date();
				var ampm = "AM";
				var hour = new Number(now.getHours());
				if (hour > 12) {
					ampm = "PM";
					hour = hour - 12;
				} else if (hour == 0) {
					hour = 12;
				}
				var minutes = new Number(now.getMinutes());
				if (minutes <= 9) {
					minutes = "0" + minutes;
				}
				var seconds = new Number(now.getSeconds());
				if (seconds <= 9) {
					seconds = "0" + seconds;
				}
				return hour + ":" + minutes + ":" + seconds + " " + ampm;
			}
		</script>
        
<!--- Calls on the CKEditor --->
<script type="text/javascript" src="ckeditor/ckeditor.js"></script>
<!--- /Calls on the CKEditor --->
        
	</head>
        
	<body onLoad="autoSaveEvery(10000)">
        
<div id="messageArea"></div>
        
<cfform name="auto" id="auto">
                 
<cftextarea richtext="true" 
<!--- toolbar="Basic" ---> 
name="entry">
</cftextarea>
            
<!---  CKeditor --->
<script type="text/javascript">
	CKEDITOR.replace( 'entry' );
</script>
<!--- / CKeditor --->

</cfform>
        
		<br><br>
		<cfoutput>
			<a href="autoSaveView.cfm?#createUUID()#" target="_blank">View Saved Data</a>
		</cfoutput>
        
	</body>
</html>

Open in new window

0
overcolor
Asked:
overcolor
  • 2
  • 2
1 Solution
 
c lCommented:
have you thought about using the ckEditor autosave plugin?

http://ckeditor.com/forums/Plugins/Autosave-Manual-Save-AJAX

all you need to do point it to your server-side script which'll handle the saving portion
0
 
overcolorAuthor Commented:
I was looking create my own code because I will need to add this in other areas, I just needed a starting point.
0
 
c lCommented:
why reinvent the wheel in this case whe there's already a plug-in that does what you want?
0
 
overcolorAuthor Commented:
I was looking for something like this, Thank you
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now