Making an embedded comment form
Maybe it was not a good idea to develop a Blog template and blogging with it at the same time. So far, I managed to have the basic functionalities in with zero code: no LotusScript, no JavaScript. And it is all valid XHTML with the style separated in a CSS file. Also, I am tracking visitors: pagehits, unique visitors and visitor sections. It's all in the tiny image bottom right, under the 'valid XHTML' bumper sticker. All with zero code, only using simple out of the box Lotus Notes/Domino features.
More cookies
Most of the blog systems have a nice feature in their comments: 'remember me on this computer'. I need to store the username, e-mail and website address in a cookie. I wrote a small JavaScript file to output all the unsafe characters and their encoded values in arrays to use with my @formulas:
I put these two arrays in two computed for display fields: [UrlUnsafe] and [UrlSafe]. I also made the two expire dates I need for permanent cookies and to delete cookies. I did this with JavaScript as well, and copy/pasted the values in two fields: [CookieDelete] and [CookieForEver]. Will the CookieForEver ever expire? Not in a hundred years :-)
Stripping HTML tags from the comment
Users can type their comment in a normal textarea field, but I want to strip out any HTML, otherwise someone could try tricks with it. With @formulas, this proved to be incredibly easy:
Next
I still have to test the form, give it layout with CSS, do form validation on the server and on the client, adding the comments to the blog entry. So one of my next posts will be how to make a proper form with XHTML, style it with CSS and use some Ajax to validate and post it without leaving the page.
Comments
26/02/2007 08:23:28, Pettrie de Bondt
Great post, it always amazes me how much you can do with a little bit of @formula. Keep up the good work
To add a comment, log in or register as new user. It's free and safe.