Guess i should throw my two cents in ...
In less serious apps, i tend to bring in CGI.pm - but for a pure HTML::Template solution, i pass a param called 'checked' (most often this param is embedded to be used in a loop context) that is either undef or the value 'checked'. Then i can use something like:I find this more elegant than using <tmpl_if>, but it is still a bit more work than i care to do on a regular basis (and the fact that it borks HTML editors doesn't bother me as i use gvim ). I really wish HTML::Template had methods to generate form elements like PHP's Smarty (but not too many - Smarty has lot's of methods that, IMHO, should not be there).<input type="radio" name="bar" value="bar1" <tmpl_var checked> />
Update:
I also wish you could use square brackets for HTML::Template
tags instead ...
Might be able to trick it with that 'Vanguard' compatibility mode ... but even if that worked, it's probably not safe.<input type="radio" name="bar" value="bar1" [tmpl_var checked] />
jeffa
L-LL-L--L-LL-L--L-LL-L-- -R--R-RR-R--R-RR-R--R-RR B--B--B--B--B--B--B--B-- H---H---H---H---H---H--- (the triplet paradiddle with high-hat)
In reply to (jeffa) Re: HTML::Template and checking arbitrary radio buttons
by jeffa
in thread HTML::Template and checking arbitrary radio buttons
by dws
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |