Prev: Error creating web service. Please ensure that you haveentered a correct Web Service name or URL.
Next: Problem connecting flex and cfc
From: joel35 on 11 Nov 2008 20:56 Using cfimage to generate a captcha image. Works locally, but on live server I get this error: java.lang.IllegalStateException: Timer already cancelled. Function for writing captcha: <cffunction name="writeCaptcha" displayname="writeCaptcha" hint="I will output the captcha image" access="remote" output="true" returntype="string"> <cfargument name="tabindex" type="numeric" required="false"> <cfset var ret = ""> <cfsavecontent variable="ret"> <cfoutput> <cflock name="captcha" type="exclusive" timeout="2"> <cfimage action="captcha" height="#getCaptchaHeight()#" width="#getCaptchaWidth()#" text="#getCaptchaString()#" difficulty="#getDifficulty()#" fonts="arial,sans-serif"> </cflock> <a href="##" id="reloadCaptcha" onClick="reload();return false" title="load a new image" style="background-image:none"><img src="/assets/images/icons/reload.png" width="20" height="21" alt="New Image" style="border:none"/></a> <br/> <input type="text" name="registrationVerification" class="formfield required" <cfif structKeyExists(arguments,"tabIndex")>tabindex="#arguments.tabIndex#"</cfif>/> <input type="hidden" name="captchaString" value="#hash(UCase(getCaptchaString() ) )#" <cfif structKeyExists(arguments,"tabIndex")>tabindex="#arguments.tabIndex#"</cfif>/><b r/> Please type the characters you see in the image. Not case sensitive. </cfoutput> </cfsavecontent> <cfreturn ret/> </cffunction> Code as it's called on the form: <cfajaxproxy cfc="model.cfcs.captcha.CFCaptchaProxy" jsclassname="CFCaptchaProxy"> <script language="javascript"> $(window).load(function(){ loadCaptcha(); });//document).ready function loadCaptcha(){ //proxy used to generate dropdown boxes var cfCaptcha = new CFCaptchaProxy(); var stringField = cfCaptcha.writeCaptcha(); $('##captchaThingy').empty().append('<img src="/assets/images/loading_orange.gif" width="31" height="31" alt="processing..."/>').empty().append(stringField); } function reload() { loadCaptcha(); return false; }; </script> |