Tuesday, June 30, 2009

Grabbing inputs from the DOM with my favorite javascript libraries

Grabbing input elements with my favorite JavaScript libraries

All inputs$$('input')YAHOO.util.Selector.query('input');
All checkboxes$$('input[type=checkbox]') Sweet with .eachYAHOO.util.Selector.query('input[type=checkbox]:checked');
All inputs in table with class .data_display $$('.data_display input') YAHOO.util.Selector.query('.data_display input');

Thursday, June 25, 2009

JBuilder 8 losing Libraries

After not running JBuilder 8 for a bit, when I tried to rebuild an applet at $work, I received a very strange set of missing class errors. These classes were right there in the Jar libraries... I swear :)

Well after a few hours of looking around I found that I need to remove the whole 'output path' option (under Run -> Configurations -> Path tab). Then it magically worked.

Go Figure.

I know JBuilder8 is ancient but one applet builds in it and nobody wants to fund it moving to Eclipse...

Tuesday, June 9, 2009

Recommended way to build URLs in Template Toolkit

On the mailing list, Andy Wardey recommended using the URL plugin as the best way to build URLs in Template Toolkit (TT). Since this is very helpful but sometimes hard to dig out of the TT documentation, I wanted to make a quick note here.

The URL plugin will make sure to properly HTML and URI encode your link(s).

Here my quick example

In your template:
[% USE profile = URL( '/profile', show_picture = 1 ) %]

<a href="[% profile( slayer = 'buffy' ) %]">Buffy's Profile</a>
<a href="[% profile( vampire = 'spike' ) %]">Spike's Profile</a>
This will render validly encoded html like:
<a href="/profile?show_picture=1&amp;slayer=buffy">Buffy's Profile</a>
<a href="/profile?show_picture=1&amp;vampire=spike">Spike's Profile</a>
Notice the & not a '&' which makes the html validation much happier.

This is much easier than trying to do it yourself with filters and/or plugins and/or custom url encoding code (please save us :)