On Mon, 3 May 2004, Mark Fuller wrote: > By way of suggestion, the way HTML::Template has various "__first__, > __last__, __counter__" helper fields, I wish there were a way to inform a > loop of a special value used to indicate the row that should get the > "selected" attribute. It seems like there's a lot of pragmatic helpers > available, but nothing for what is a very basic HTML construct. Why not a > reserved variable name like __selected__ and HTML::Template would fill it in > automatically if a corresponding boolean is true for that row? Would this be > any more efficient (or beautiful) than Puneet's suggestion?
I don't think this is too much code to expect people to write: $row{__selected__} = "selected" if $value; That's really all you're talking about, right? > It just seems to me like "selected" and "checked" are fairly basic and > there's no easy (more built-in) way to accomodate them. It seems like you > recognize that they require a bit of ugliness. Why not provide for them > somehow? Because CGI.pm already has it nailed. Why reinvent the wheel? And you can't beat the simplicity: $template->param(year_select => scalar $query->popup_menu(-name => 'year', -values => [ 1970 .. 2020 ]) ); And in the template: <tmpl_var year_select> I've been doing it for years now and it's never done me wrong. -sam ------------------------------------------------------- This SF.Net email is sponsored by: Oracle 10g Get certified on the hottest thing ever to hit the market... Oracle 10g. Take an Oracle 10g class now, and we'll give you the exam FREE. http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click _______________________________________________ Html-template-users mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/html-template-users