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

Bill Moseley moseley at hank.org
Wed Apr 4 05:53:23 GMT 2007


On Tue, Apr 03, 2007 at 08:53:32PM -0700, Quinn Weaver wrote:

> In contrast to FormBuilder, RHTMLO wants you to write your HTML form
> by calling Perl methods, somewhat in the spirit of CGI.pm.  This makes
> it hard for design people to edit the form.

Maybe I'm not understanding that paragraph, but in RHTMLO (IIRC) you
can do [% form.field('foo').xhtml %] in a template.  What are
you thinking would be easier for the design people?

> Also, Catalyst::Controller::FormBuilder accepts YAML as input,
> whereas RHTMLO depends on Perl.  (Again, see below for a sample.)  YMMV,
> but the design people here are relatively comfortable editing YAML and
> quite uncomfortable editing Perl code.

Yes, I guess YMMV is true.  I think of what fields are processed by a
form submission to be in the realm of the programmers, not the design
people.  The form layout, on the other hand surely needs to be in the
hands of the designers.

I find that each form often requires specific processing and
validation that has to be accomplished in Perl anyway.  So, having a
single Perl class that defines the form's fields along with any
special validation code works nicely.

> So those are, to me, cases of sub-optimal separation of concerns.
> 
> On the other hand, I guess it is possible with RHTMLO to take the
> generated (X)HTML and plunk it into a TT template.  The rest of
> the template is still editable by your XHTML/CSS/Javascript design people.
> 
> This does mean, however, that the design people have to come to you,
> the programmer, if they want changes to the form--e.g. if they want
> to change the contents of a <div> or, if, in plain HTML land, they want
> to change the type of an <input>.  (Obviously the problem is ameliorated
> in XHTML, since they can change some stuff using CSS.)  You can imagine
> the same thing happening for form-related Javascript.

I don't like the form code to generate html.  I do that in the
templates, just for the reasons you describe above.  If there's a form
element that's a select list then the html/template editors can change that
to a radio select if they like without changing how the form is
defined.

As for javascript, I only do limited form validation -- required
fields, and so on.  And I feel that's often done better unobtrusively,
as they say.  That's harder if you want complete javascript validation
of specific constraints, of course.


-- 
Bill Moseley
moseley at hank.org




More information about the Catalyst mailing list