I was thinking about the previous regime of Greymatter support and how we could make…
Javascript to Save a Commenter’s Info

Problem: I would like a commenter’s name, email, and homepage to be remembered after they comment and to automatically appear in the comment form fields.
Solution: GreyMatter comes with the javascript to do this, however, it isn’t “hooked up” so to speak. A little template modifications and you are good to go.
First make sure that you have the cookie code variable ({{cookiescode}}) in your Entry Page Template templates (which the standard templates that ship with GM do).
Add these lines to your “{{entrycommentsform}} Posting Form” template:
Code:
<SCRIPT TYPE=”text/javascript” LANGUAGE=”JavaScript”>
<!–//
document.newcomment.newcommentauthor.value = getCookie(“gmcmtauth”);
document.newcomment.newcommentemail.value = getCookie(“gmcmtmail”);
document.newcomment.newcommenthomepage.value = getCookie(“gmcmthome”);
document.newcomment.newcommentauthor.focus();
//–>
</SCRIPT>
<input name=”bakecookie” type=”checkbox” />Save Info?<br />
This goes nicely just in front of the ‘Reset’ button.
Lastly, modify your submit button to call the ‘setGMcookies’ javascript function. In your “{{entrycommentsform}} Posting Form” template change:
Code:
<input type=”submit” value=”Submit” class=”button” />
to:
Code:
<input type=”submit” value=”Submit” class=”button” onClick=”javascript:setGMcookies()” />
Discussion: As features have been added, not all of them have been documented, particularly with the powerful template system that GreyMatter has. This recipe doesn’t require any code modification, yet it is able to significantly enhance the user experience. If every template configuration were absorbed into the code, GreyMatter would quickly become unusable.
Note: If you have trouble getting the javascript to work, most browsers have an ‘Error Console’ that may give some feedback. Also, Firebug is an amazing Firefox plugin that can be very helpful.