Re: [htmltmpl] A valid reason for template support for select lists?
Brought to you by:
samtregar
From: Sam T. <sa...@tr...> - 2003-10-19 21:34:54
|
On Sun, 19 Oct 2003, Mark Fuller wrote: > I just found html::template and it's exactly what I was looking for. The > only thing that is a minor shortcoming for me is the inability to do option > select lists. I understand the emphasis on keeping a template a template > (and languages separate). But, here's an example of why I believe it is > justifiable to provide for an "if" inside the variable loop that would emit > an option list. Are you saying you can't do this now? I've produced <select> boxes with HTML::Template. It requires a nasty pile of <tmpl_if> logic but it's doable. My prefered method is to just use CGI.pm's popup_menu() and use it to fill a single <tmpl_var>. I find this results in easily maintainable code with the minor caveat that the HTML designer won't be able to easily modify the contents of the <select>. In practice this isn't much of a problem; the contents of form controls are usually my job. > Am I on the right track if I use template::expr inside an options list and > test at each option to know if I should emit the selected attribute? Sure, that's another way to do it. -sam |