[Catalyst] RFC: HTML::Widget / Ajax / Catalyst
Bryan Roach
opus at b-love.org
Fri May 5 14:40:47 CEST 2006
>? For controls with callbacks or other custom stuff that cannot
>be translated to Javascript mechanically, you generate AJAX
>hooks. These hooks do not validate an individual field, they
>send the entire form to the server as if it was a regular POST,
>except that it?s marked as a validation-only request. The
>server then runs all the normal form validation, but stops
>processing the request after at that point, and sends back the
>result as something easily parsable, probably JSON, because XML
>is too much work to monkey with.
>And well, that?s it. This honours DRY and keeps the user
>experience pleasant.
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 the nicest design for this module would be to simply have
config flags for the three types of validation, and then you can turn
each type on or off according to your preferences.
Bryan
More information about the Catalyst
mailing list