archives greymatter top

powazek productions
{ personal log }

new log feature: remember me!

Thanks to this tutorial and this discussion, my humble log now has a new feature: it will remember who you are (if you ask it to) so you don't have to enter your info every time you want to leave a comment. Read on to see how it works.


The details: at the bottom of the comment form, you'll now see two boxes: "remember me" and "forget me." Leave them both unchecked to comment the way you always have.

If you'd like the site to remember your information, click the "remember me" box and then post as usual. From then on, whenever you visit the powazek log from that computer, your info will automatically appear in the form. That's because a cookie has been left on your computer. If you are not the only person who uses your computer, don't use this feature!

If you then like this site to forget your information, just click the "forget me" box and then post as usual. The site will delete your cookie and you'll go back to being a stranger to us. (We'll always have the memories.)

Optionally, if you want to delete the cookie but you don't have much to say, you can just click the "forget me" box and hit "preview." You'll get an error, but that's okay - the cookie has been deleted.

For all you Greymatter hounds out there, I tweaked the existing tutorial to present the "forget me" button in a friendlier way. Feel free to snoop my code to see how it's done - it's all there in view source. Speaking of, any techies out there know how I can tweak the javascript to allow me to use radio buttons instead of checkboxes? That would be better - it wouldn't allow someone to check both, which doesn't break anything but is kinda stupid to allow - but I couldn't quite figure out the javascript changes required to make it work. It would need to change, but I'm not sure how. Check my post ("fraying") in this discussion for the details. Nevermind! It's fixed now. Thanks Alan!

{ 1:34pm }



» Let's say you have two radio buttons

<form name = "theForm">
<input type = "radio" name = "heyzeus"> Remember Me
<input type = "radio" name = "heyzeus"> Forget Me

Javascript creates a zero based array/object/collection/whatever called 'heyzeus' (or whatever you've named the radio buttons), which can be accessed in javascript as follows.


Of course, that does you no good, as it will return a value of [object]. To determine which button is checked, used the following syntax.


The order of the radio buttons in the collection is determined by the order of their appearance in the html code. Therefore, in this example heyzeus[0] refers to the radio button next to 'Remember Me', and heyzeus[1] refers to the button next to 'Forget Me'.

So, in your memory() function, you should have something like this

if(document.theform.heyZeus[0].checked == true)(
//do remember me stuff
else if(document.theform.heyZeus[1].checked == true)(
//do forget me stuff

You'll be quizzed on this next Monday.

Alan  { 9.19.01 @ 7:05pm }

» Crap, the name of the form should be all lowercase, like so

Figures I'd miss that in the first five previews

alan  { 9.19.01 @ 7:07pm }

» *sigh*

<form name = "theform">

– alan  { 9.19.01 @ 7:08pm }

» Alan, I think I love you.

Off to tweak javascript....

Derek M. Powazek  { 9.19.01 @ 10:29pm }

» I do believe it's fixed. Thank you SO much Alan!

If anyone has any problems with this feature, please post them here. Thanks!

Derek M. Powazek  { 9.19.01 @ 10:40pm }

» Glad you got it sort it. Also glad my silly loopy-from-jetlag posts were removed!

Tom Cosgrave  { 9.20.01 @ 8:53am }

» And here's a little tip for making the form elements a little more user friendly. Add an id to the radio button and put a label tag around the text next to it that references that id. Like so:

remember me

That way, when you click on remember me, the radio button will check (meaning that it works more like a radio button should). I know this works on IE4+ on the PC...not sure about other browsers on other platforms.

(I think you could also add a style to the text so that the cursor turns into a hand when you mouse over it (because it currently doesn't for some reason.))

jkottke  { 9.20.01 @ 9:17am }

» Oh for crying out's the code:

<input TYPE="radio" NAME="cookieme" value="bake" id="chocolate"> <label for=chocolate>remember me</label>

jkottke  { 9.20.01 @ 10:04am }

» Heh. Yeah. These forms aren't great for code, eh?

Anyway, Jason, thanks! I just added the labels. And they work! Woohoo!

Derek M. Powazek  { 9.20.01 @ 10:06am }

» Just another idea for a comment feature I thought of:

Because I sometimes like to read other people's comments in response to my own, I added a feature to my own weblog which is basically a checkbox saying: [email me future responses to this entry].
Backend-wise, all the server does is add the submitter's email to a list in a table related to each entry. So, when a future user submits an entry, the server crossreferences the list of emails for each entry that want to hear about it and it sends them an email.
Of course, I have yet to implement I 'remove' feature, but it shouldn't be difficult to include a URL in the email that automatically passes a command to the server to remove that email from the reply list.

– MaTias  { 9.20.01 @ 10:57am }

» in trying times, desparate hands click 'remember me' in the hopes that their spirits may be maintained; and yet, in times of utter despair, one finds oneself compelled to click 'forget me', obsessively, to no gratifying effect.

maybe some explanation of what the text for the radio buttons means besides them would be good? (i.e. this will store your name/email/url settings, or prevent the browser from doing so.)

otherwise, it looks good. i appreciate the ability to delete the cookie. some of the other comment systems i've used (blog voices? i don't know the name of it) store a cookie but don't give you the option to delete it, or not store it in the first place. maybe that's just an option of the site's maintainer (no offense to the blog voices person if they didn't write things explicitly so).

moz  { 9.20.01 @ 2:19pm }

» Moz - Good idea! I added title tags to Jason's labels. Mouse over, baby!

(I love this collaborative tweaking....)

Derek M. Powazek  { 9.20.01 @ 3:05pm }

» Thanks for the point out Derek.

Dan  { 9.21.01 @ 8:31am }

» hmm..I seem to be having problems with the forget me option

Dan  { 9.21.01 @ 9:49am }

» oooh.. I like it.. I like it

Kevin-John  { 9.21.01 @ 10:26pm }

» Thank you, Derek, for making this happen and sharing with the rest of us!

eric  { 10.10.01 @ 10:41am }


« before     { current }     after »

{ news }
» Goodbye old friend.

» Don't miss the photos and audio from Fray Cafe 2.

» Psst. Hey kid. Wanna buy some swag?

{ me.elsewhere }
  My snail tracks on the web.
» DfC profile
» New Riders profile
» Amazon wish list
» {fray} is page
» Mirror Project pics
» FilePile profile
{ new in dfc }
  Gaming the system: How moderation tools can backfire
Sometimes all the widgets backfire, encouraging the very behavior they're designed to avert. The rules have a dangerous side-effect: they create a game.
{ new in fray }
  "I wanted to spend the 4th with someone who always knew the way back home."

Counting Flags by Kevin Smokler.
{ new in sfstories }
  the slow glimmering descent
I've been watching fireworks there for years, but last night was different. And not just because it was clear.
{ new in fray org }
  fray day 6
Fray Day 6 is coming to cities all over the world on September 14, 2002. Come tell your story.
{ see also }