I'm a noob with CF, but proficient with classic ASP and PHP, so bear with me.
I wanting to set/retrieve a cookie, but to give the user control over whether
to set or clear this cookie:
Username [_______]
[]Click here to remember your username [Submit]
Okay, the user enters their username, the checks the box, and the next time
he comes to the form:
Username [JoeB___]
[]Click hear to clear your username cookie [Submit]
I've been able to get the checkbox to appear back/forth and remember the
username, but not the combination.
Here's my direct questions:
How do I populate the value of a field with its cookie value, but not generate
an error if there is no cookie set?
Should I use CFIF IsSet("Cookie.Username") / CFELSE to determine which form
checkbox to displays?
The server I'm working on has CF 5 btw.
Also, besides this newsgroup, what code snippet/tutorial sites or books would
you recommend? So far I'm liking CF, it's just getting the hang of the
variables and syntax...
Thanks,
Todd
Swift - 22 Oct 2004 16:37 GMT
Todd,
How about this:
<CFSet thisusername = "">
<CFIf parameterexists(cookie.username)>
<CFSet thisusername = trim(cookie.username)>
</CFIf>
<CFOutput>
<input type="text" name="username" value="#thisusername#">
</CFOutput>
Swift
Todd E - 29 Oct 2004 21:09 GMT
Cool, thanks!
(been out of it a few days, sorry so long to reply...)
Todd