Monthly Archives: August 2007

piston saves!

I download a prerelease of the latest Engines earlier in the summer with piston. My tests were failing in strange and magical ways. I spent quite a bit of time trying different things, then finally resorted to a fresh Rails app that I slowly populated with relevant files. Quickly I discovered the [...]

mootools and form field hints

Usually I love mootools, really. Usually. I found CSS Guy’s form field hints posting inspiring, so I modified it to work with mootools. The result is something simple and easy.

$ES(’div.hint’).each(function(el) {
new Element(’div’).addClass(’hint-pointer’).setHTML(’ ’).injectInside(el);
});
$each(document.forms, function(form) {
$each($(form).getElementsBySelector(’input, select’), function(input) {
if($(input).getParent().getElementsByTagName(’div’)[0]) {
$(input).addEvent(’focus’, function(e) {
hint = $E(’.hint’, this.getParent());
hint.setStyle(’display’, ‘inline’);
hint.effect(’opacity’, {duration: 500, wait: false}).set(0).start(1);
}.bind(input));
$(input).addEvent(’blur’, function(e) {
hint = $E(’.hint’, [...]

dry model validations with class_eval

I find myself having to validate an email address in a couple of different models. I’ve had to refine the pattern a couple of times, but don’t always remember to do it in every place, which is silly anyway. Since I don’t feel the need to delve into a new validation, like a [...]