I have a perplexing 'autoSave not defined' error...

Posted on 2010-11-26
Last Modified: 2012-08-13
Console Error:
autoSave is not defined
[Break on this error] var timeout = setTimeout('autoSave()',ms);

I've tried several different 'fixes', but this error persists.  The ajax call returns as it should.  The error occurs post to the click function.

I believe the error is occurring at line 13.

<script type="text/javascript">

	$(document).ready(function() {
		function autoSave(){
			ColdFusion.Ajax.submitForm("finalRender", "/admin/emailBeta/act/", callBack, callError);
		function autoSaveEvery(ms) {
			var timeout = setTimeout('autoSave()',ms);
		function callBack(res) {
			if (res) {
			document.getElementById('messageArea').innerHTML = 'Autosaved at ' + nowFormated();
		function callError(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;
		$("#saveEmail").click(function () {


<div id="messageArea">Message Area</div>

Open in new window

Question by:brianmfalls
LVL 16

Accepted Solution

jmatix earned 500 total points
ID: 34219309

function autoSaveEvery(ms) {
      var timeout = setTimeout('autoSave()', ms);


function autoSaveEvery(ms) {
      var timeout = setTimeout(autoSave, ms);

LVL 51

Expert Comment

by:Huseyin KAHRAMAN
ID: 34219372
this one works fine...
so try to remove

$(document).ready(function() {

function autoSave(){
var timeout = setTimeout('autoSave()',1000);

Open in new window


Author Closing Comment

ID: 34219428
Thanks jmatix, that did the trick.

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
jQuery on click requires double click 6 28
Prevent / reduce email harvesting using an image – javascript approach ? 14 68
Compute age Html 2 24
Echo'd values in dropdowns 6 28
Recently while working on a project I got a very annoying cfdocument has no body error message. I had never seen this error before. So I checked the code. The code was pretty simple; it was Just showing me the cfdocumnt tag and inside that tag a …
Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question