Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / ColdFusion / Getting Started / October 2004



Tip: Looking for answers? Try searching our database.

Cookie Combo

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Todd E - 21 Oct 2004 19:03 GMT
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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.