good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
(jeffa) 5Re: Converting large numbers of checkboxes to small number of paramsby jeffa (Bishop) |
on Jul 10, 2003 at 05:18 UTC ( [id://272895]=note: print w/replies, xml ) | Need Help?? |
You are absolutely correct. I chose to rewrite the original
using nothing but CGI.pm to demonstrate that it can be done.
I do that from time to time just to keep my CGI.pm skills
sharp - while i rarely use CGI.pm in production, i use it
all the time here at the Monastery.
If you look carefully, you will see that checkboxes are each embedded inside their own table cell ... this makes using CGI.pm's checkbox_group() next to impossible. I'll bet a dollar or two that this was the motivation for checkbox(). This is so much easier to handle with HTML::Template, IMHO: But now we lost form stickiness. Quite some time ago, samtregar posted this node that suggests combining CGI.pm's HTML form element generating methods with HTML::Template. We can simplify the template code even further by allowing CGI.pm's td() method to handle that 'loop'. Here goes: Depending upon how much control your designers need, you can swing the pendulum in either direction when you combine HTML::Template with CGI.pm instead of using it as an alternative/replacement. In the case of a checkbox, there isn't much to change, and anything you can change should probably be done via CSS. But in the case of the table cells (<td> tags), there could be a lot to change and taking that away from the designers is probably not good. However, one could argue that the programmer should specify the CSS class of the <td> tag and allow the designers to define the CSS rules. In that case, mixing CGI.pm may not be a bad idea. 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 Section
Seekers of Perl Wisdom
|
|