Reputation: 1305
I'm making a CAPTCHA for some ColdFusion forms and I can't understand why this isn't working.
<cfimage action="captcha" width="300" height="75" text="#captcha#">
<input type="hidden" name="captchaHash" value="#captchaHash#">
The above is the code I'm using to create the CAPTCHA within the cfform.
<cfset captcha = makeRandomString()>
<cfset captchaHash = hash(captcha)>
Those are the variables that I set when my form loads. I can put the function, makeRandomString on here but it shouldn't have any bearing on my problem.
Basically, for whatever reason when I process the form the hashed captcha value in the hidden input is not carrying over. I've output it to the screen on the process page and it just says #captchaHash# rather than the hashed value of the captcha. If I output it to the screen on the form page itself before it is processed it works fine. So, I was hoping that somebody could help me pass my captchaHash value from my cfset to my hidden input and solve this stupid problem.
Thanks!
Upvotes: 2
Views: 2109
Reputation: 146
From what you posted it sounds like you just need to wrap the variable in a cfoutput tag to get it to work.
Upvotes: 7