ColdFusion 8 autosave not working

I'd like to use the CF8 autosave function to save form data every 30 seconds.  I found a few resources on line (learncf.com and Sam Farmer) and have implemented the following:

Added these js functions:

function autoSave(){
ColdFusion.Ajax.submitForm("NameofForm", "URLforprocessingtemplate", setSaveTime);
autoSaveEvery(30000);
}
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;
}

Also added autoSaveEvery(30000) to the body onload event.

When I open the form, the autosave appears to be working -- every 30 seconds the autosave message is updated indicating the time when the form was saved.   However, nothing is actually saved.  

I've looked over the code and cannot figure out what's missing.  
rfoneillAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
duncancummingConnect With a Mentor Commented:
Can you try outputting the value of 'res' in your setSaveTime function?


0
 
rfoneillAuthor Commented:
Thanks!!

I output res in the message area:

document.getElementById('messageArea').innerHTML = res;

And was able to see the processing template was throwing an error.  I revised my template and it's now working.

Thanks again!!
0
All Courses

From novice to tech pro — start learning today.