Awesome form validation script


I use the Javascript libraries Prototype and a good deal in my projects, but there was one feature they didn't have between them - form validation. A quick google uncovered a super-simple solution to this problem written by an Australian - all you need to start is one Javascript file and one line of Javascript, then add one single DOM-compatible attribute to your input lines and it'll work right out of the box. The even better part is that extending and enhancing it is very easy, just add a CSS line or two to customize your error messages, etc, easy as pie.

Catfish fun with

Tags: is a wonderful library of Javascript functions for doing lots of buzzword-friendly snazzy effects. A recent schmancy JS trick is the catfish - a small, unintrusive advertisement that pops up at the bottom of the web page and can be closed without affecting the web page. Looking around I didn't see any existing code to do catfish effects with so I decided I'd have to fill the gap.

There are four parts to a catfish - the Javascript libraries (, which relies upon Prototype), a little bit of HTML structure on your page, some CSS and a single Javascript line. So lets get to it.

To do any of this fancy stuff you need both the Prototype and libraries on your site and then load them into the page as follows:

<script src="js/prototype/prototype.js" type="text/javascript"></script>
<script src="js/" type="text/javascript"></script>

Don't forget to change the paths to whatever is correct for your site.

The HTML below needs to be one of the last segments within your HTML, basically it needs to be the last code before the close-BODY tag, so that nothing else throws it off. There's also a link to hide the catfish, you don't want to upset your visitors!

<div id="footer_ad" style="display:none"> <div id="footer_close">[x] <a href="#" onclick="Effect.BlindUp('footer_ad', {duration:1})">close this</a></div>
Catfish is tasty!

You can put whatever fillings you like in there - nested divs, etc, basically eat your heart out.

The CSS part is pretty straight forward, basically we're setting the div to be locked to the bottom of the web browser window so it slides over the other content - this is a general trick that works great for e.g. shopping cart totals, menus, etc. I used some fairly ugly colors just to make it stand out during testing :-) And for those who don't know, this should either go in your page's CSS file or within a STYLE tag in your page's HEADer.

#footer_ad {
position: fixed;
bottom: 0px;
display: block;
width: 100%;
background-color: #b7948f;
color: #394a8c;
font-size: 24px;
padding: 10px 0 10px 0;
margin: 0;
left: 0;
border-top: 1px solid #9a5261;
#footer_close {
float: right;
width; 50px;
display: block;
font-size: 0.6em;
padding: 5px;
text-align: right;
font-size: 0.8em;

Last but not least is the Javascript code to make the screen pop up. The best location for this is your body tag's onload attribute, but you could embed it in the page if needed (within a SCRIPT block):

new Effect.BlindDown('footer_ad', {duration:2});

Put that altogether and you too can have some tasty catfish for your site.

There's one last thing, the way the above code works the catfish will keep popping up every time the page is loaded, its left up to an exercise for you on how you'd like to make the close link make the browser remember to hide it. One idea would be to have the onclick event execute a function on the server side to set a session variable that would indicate the visitor no longer wished to see the catfish, then in the presentation code only display the catfish if the visitor doesn't have this variable set; alternatively some Javascript could set a cookie, but I prefer to consolidate all client data in viewer sessions, so there's only one source for all of the relevant data.

Bon appetitè!

New Information Architecture book is awesome


I picked up a review copy (review forthcoming) of O'Reilly's new Information Architecture for the World Wide Web, 3rd edition, and so far it is a simply inspiring book. I'm only fifty-ish into its almost 500 pages but I've already started to brainstorm ideas for a huge improvement to the website at work, which I intend starting shortly after the holidays. Of all of the tech books I've read this is so far one of the best from a general knowledge point of view - the lessons to be learned in this book aren't just for web development, they're for anyone creating any sort of software. While I'm far from finishing it I already would have to count it as a must-read for anyone developing websites, both internal and public-facing, you won't be disappointed!

Agile Web Development 2nd edition out now


The second edition of Agile Web Development with Rails is now available in its dead-tree version. Mine arrived yesterday, when will yours?

I've actually been reading this over the last few months via the in-development PDFs (through their early release program) and it is definitely a great book. The page count has gone up with this issue as both additional topics are added and existing ones have been fleshed out. Written to match Ruby on Rails v1.2, which isn't even out yet, there are quite a number of new features to explain and, from what I've seen so far, it is once again easy to follow. I guess my number of active books has just gone up again, its probably back to six at this point X-)


Subscribe to Front page feed