[Catalyst] RFC: HTML::Widget / Ajax / Catalyst

Len Jaffe lenjaffe at jaffesystems.com
Fri May 5 15:47:51 CEST 2006



> Bryan Roach <opus at b-love.org> wrote:
> That could work, but it also seems quite inefficient
> for larger forms.
> In my opinion, the DRY principle should never be
> used to determine the
> way your application functions. You should determine
> the best way for
> your application to function, and THEN apply DRY to
> implement that
> functionality efficiently. With a careful design,
> you can create a
> single-field AJAX validator function and another
> entire-form validator
> function without ever repeating yourself.

I think we're on the same page, just different
paragraphs, or maybe I'm just staring at the pictures.

I think it makes sense to pre-validate on the client,
and validate on the server.  I think it maksense to be
able to validate the whole form at once & one field at
a time on the server, and one field at a time on the
client.

Now I personally would probably not use ajax to to
server-side-single-field (sssf) validation unless that
validation required some lookup that could only be
performed on the server side (e.g. insuring that the 
entered location is within 5 miles of an expensive
coffee shop).  But I support your right to do so.

So what we need is smart code that can perform sssf as
needed, and also generate client-side-single-field
(cssf) in JS.  Then we need some code to manage
server-side-multiple-field validation. Not just whole
form, but any combination one cares to define.

once you have all that infrastructure, its just the
busy work of the plumbing.  In catalyst terms, an
action to front end each sssf ajax call, one to
front-end each of the ssmf ajax calls including whole
form, and one for whole form, non-ajax.  But the
difference between the the two whole form actions is
in the view. With ajax, you'll render a chunk of xml
or json, without ajax you'll render a whole page.

I'm going to stick with TT, an formvalidator until my
DBIC legs are firmly under me. 

One major component upheaval at atime. That's my
motto. Well, no it isn't, but you get my point.

L.






More information about the Catalyst mailing list