[Catalyst] Re: HTML::FormFu and Rose::DB::Object?

John Siracusa siracusa at mindspring.com
Wed Apr 4 17:29:41 GMT 2007


On 4/4/07 11:58 AM, Bill Moseley wrote:
> Another approach I have taken is to have a widget library defined in a
> template.  I then use macros to display the form elements
> individually:
> 
>     [% field( 'Event Start Date', 'start_date' ) %]
> 
> And the widget library determines how to generate the html,
> where to put the little calendar icon, set a class tag so
> javascript can find it in the DOM, and include the required
> javascript.
> 
> Not sure there's any advantage to that way, though.  RHTMLO spits out
> html that's easy enough to style with CSS.  Plus, it's likely anyone
> that can dive into the template widget library probably could dive
> into Perl as well.
> 
> It does give you that warm feeling knowing there's not a lick of html
> in the application code. ;)
> 
> But, it does have an advantage that, say, error messages associated
> with a field can be rearranged easily in the widget template by the
> html person.  Although, I suppose even that can be easily done
> with CSS.

The same approach could be taken with RHTMLO, with widget display delegated
to templates or macros rather than directly to methods.  Those templates may
or may not ask for smaller bits of HTML from the Perl objects.

You could, in theory, eschew RHTMLO's HTML generation methods entirely (as
long as the HTML you produce "by hand" has the expected field names and so
on).  But I think that'd get old really fast.  Rearranging bits of a field
is fine, but who wants to create, say, select-box HTML by hand? :)  I think
you'll always end up asking RHTMLO objects for the "boring" HTML bits.

-John





More information about the Catalyst mailing list